summaryrefslogtreecommitdiff
path: root/includes/js/dojo/tests/data/utils.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-14 15:39:19 +0000
commit1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch)
tree3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojo/tests/data/utils.js
parent104d59099e048688c4dbac37d72137006e396558 (diff)
downloadsemanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz
semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojo/tests/data/utils.js')
-rw-r--r--includes/js/dojo/tests/data/utils.js203
1 files changed, 0 insertions, 203 deletions
diff --git a/includes/js/dojo/tests/data/utils.js b/includes/js/dojo/tests/data/utils.js
deleted file mode 100644
index 8b26037..0000000
--- a/includes/js/dojo/tests/data/utils.js
+++ /dev/null
@@ -1,203 +0,0 @@
-if(!dojo._hasResource["tests.data.utils"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["tests.data.utils"] = true;
-dojo.provide("tests.data.utils");
-dojo.require("dojo.data.util.filter");
-dojo.require("dojo.data.util.sorter");
-
-tests.register("tests.data.utils",
- [
- function testWildcardFilter_1(t){
- var pattern = "ca*";
- var values = ["ca", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testWildcardFilter_2(t){
- var pattern = "*ca";
- var values = ["ca", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testWildcardFilter_3(t){
- var pattern = "*ca*";
- var values = ["ca", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testWildcardFilter_4(t){
- //Try and match <anything>c<anything>a*b
- var pattern = "*c*a\\*b*";
- var values = ["ca", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertFalse(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testWildcardFilter_5(t){
- var pattern = "*c*a\\\\*b";
- var values = ["ca", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertFalse(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testWildcardFilter_caseInsensitive(t){
- var pattern = "ca*";
- var values = ["CA", "california", "Macca", "Macca*b", "Macca\\b"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern, true))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern, true))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern, true))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern, true))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern, true))!== null);
- },
- function testSingleChar_1(t){
- var pattern = "bob?le";
- var values = ["bobble", "boble", "foo", "bobBle", "bar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testSingleChar_2(t){
- var pattern = "?ob?le";
- var values = ["bobble", "cob1le", "foo", "bobBle", "bar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testBracketChar(t){
- //Make sure we don't treat this as regexp
- var pattern = "*[*]*";
- var values = ["bo[b]ble", "cob1le", "foo", "[bobBle]", "b[]ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testBraceChar(t){
- //Make sure we don't treat this as regexp
- var pattern = "*{*}*";
- var values = ["bo{b}ble", "cob1le", "foo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testParenChar(t){
- //Make sure we don't treat this as regexp
- var pattern = "*(*)*";
- var values = ["bo(b)ble", "cob1le", "foo", "{bobBle}", "b()ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testPlusChar(t){
- //Make sure we don't treat this as regexp, so match anything with a + in it.
- var pattern = "*+*";
- var values = ["bo+ble", "cob1le", "foo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testPeriodChar(t){
- //Make sure we don't treat this as regexp, so match anything with a period
- var pattern = "*.*";
- var values = ["bo.ble", "cob1le", "foo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testBarChar(t){
- //Make sure we don't treat this as regexp, so match anything with a pipe bar
- var pattern = "*|*";
- var values = ["bo.ble", "cob|le", "foo", "{bobBle}", "b{}ar"];
-
- t.assertFalse(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testDollarSignChar(t){
- //Make sure we don't treat this as regexp, so match anything with a $ in it
- var pattern = "*$*";
- var values = ["bo$ble", "cob$le", "foo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testCarrotChar(t){
- //Make sure we don't treat this as regexp, so match anything with a ^ in it
- var pattern = "*^*";
- var values = ["bo$ble", "cob$le", "f^oo", "{bobBle}", "b{}ar"];
-
- t.assertFalse(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertTrue(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testEscapeChar(t){
- //Make sure we escape properly, so match this single word.
- var pattern = "bob\*ble";
- var values = ["bob*ble", "cob$le", "f^oo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- },
- function testAbsoluteMatch(t){
- var pattern = "bobble";
- var values = ["bobble", "cob$le", "f^oo", "{bobBle}", "b{}ar"];
-
- t.assertTrue(values[0].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[1].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[2].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[3].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- t.assertFalse(values[4].match(dojo.data.util.filter.patternToRegExp(pattern))!== null);
- }
- ]
-);
-
-
-}