Author: reebalazs
Date: Thu Oct 4 18:33:34 2007
New Revision: 47154
Modified:
kukit/kukit.js/trunk/tests/test_kssparser.js
Log:
Separate tests for event selectors
Modified: kukit/kukit.js/trunk/tests/test_kssparser.js
==============================================================================
--- kukit/kukit.js/trunk/tests/test_kssparser.js (original)
+++ kukit/kukit.js/trunk/tests/test_kssparser.js Thu Oct 4 18:33:34 2007
@@ -227,43 +227,50 @@
'Wrong value : unallowed characters after the property', 17);
};
- this.testEventValue = function() {
- // Parsing event value (now methods allowed too)
-
+ this.testEventValueSimple = function() {
+ // Parsing event value
var txt= "b";
var cursor = new kukit.tk.Cursor(txt);
var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.value.methodName, 'b');
+ };
+ this.testEventValueMultiword = function() {
// multiword ok but does not finish
- txt= "b c";
- cursor = new kukit.tk.Cursor(txt);
- parser = new kukit.kssp.EventValue(cursor, null, true);
+ var txt= "b c";
+ var cursor = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(cursor.pos, 1);
this.assertEquals(parser.value.methodName, 'b');
+ };
+ this.testEventValueStartsWithSpace = function() {
// space ok but does not finish
- txt= " b";
- cursor = new kukit.tk.Cursor(txt);
- parser = new kukit.kssp.EventValue(cursor, null, true);
+ var txt= " b";
+ var cursor = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(cursor.pos, 0);
this.assertEquals(parser.value.methodName, '');
+ };
+ this.testEventValueWithComment = function() {
// ok, does not finish
- txt= "apples/* more comments and*/";
- cursor = new kukit.tk.Cursor(txt);
- parser = new kukit.kssp.EventValue(cursor, null, true);
+ var txt= "apples/* more comments and*/";
+ var cursor = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(cursor.pos, 6);
this.assertEquals(parser.value.methodName, 'apples');
+ };
+ this.testEventValueWithBinderId = function() {
// params ok
- txt= "click(x)";
- cursor = new kukit.tk.Cursor(txt);
- parser = new kukit.kssp.EventValue(cursor, null, true);
+ var txt= "click(x)";
+ var cursor = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.value.methodName, 'click');
this.assertEquals(parser.value.arg.isMethod, false);
@@ -278,14 +285,13 @@
//cursor = new kukit.tk.Cursor(txt);
//this.assertParsingError(kukit.kssp.EventValue, cursor, null, true,
// 'Excess characters after the property value', 16);
-
};
this.testEventValueWithValueProvider = function() {
// methods ok
- txt= "click(kssAttr(x))";
- src = new kukit.tk.Cursor(txt);
- parser = new kukit.kssp.EventValue(src, null, true);
+ var txt= "click(kssAttr(x))";
+ var cursor = new kukit.tk.Cursor(txt);
+ var parser = new kukit.kssp.EventValue(cursor, null, true);
this.assertEquals(parser.finished, true);
this.assertEquals(parser.value.methodName, 'click');
this.assertEquals(parser.value.arg.isMethod, true);
@@ -295,9 +301,9 @@
this.testEventValueWithValueProviderRejectsAccessValues = function() {
// no more values in the method
- txt= "click(kssAttr(x), aaa)";
- src = new kukit.tk.Cursor(txt);
- this.assertParsingError(kukit.kssp.EventValue, src, null, true,
+ var txt= "click(kssAttr(x), aaa)";
+ var cursor = new kukit.tk.Cursor(txt);
+ this.assertParsingError(kukit.kssp.EventValue, cursor, null, true,
'Wrong event selector : [,] is not expected before the closing
parenthesis. :<EVENTNAME>(<ID>) can have only one parameter.', 000);
// XXX add more failing cases, maybe?
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins