@@ -35,6 +35,10 @@ QUnit.test("where to filter", function(){
35
35
} , "got intersection" ) ;
36
36
} ) ;
37
37
38
+ var stringIncludes = function ( strA , strB ) {
39
+ return strA . indexOf ( strB ) >= 0 ;
40
+ } ;
41
+
38
42
QUnit . test ( "Searchable string" , function ( ) {
39
43
// Create a set type that is used to do comparisons.
40
44
function SearchableStringSet ( value ) {
@@ -44,7 +48,7 @@ QUnit.test("Searchable string", function(){
44
48
canReflect . assignSymbols ( SearchableStringSet . prototype , {
45
49
// Returns if the name on a todo is actually a member of the set.
46
50
"can.isMember" : function ( value ) {
47
- return value . includes ( this . value ) ;
51
+ return stringIncludes ( value , this . value ) ;
48
52
} ,
49
53
"can.serialize" : function ( ) {
50
54
return this . value ;
@@ -54,31 +58,31 @@ QUnit.test("Searchable string", function(){
54
58
// Specify how to do the fundamental set comparisons.
55
59
QueryLogic . defineComparison ( SearchableStringSet , SearchableStringSet , {
56
60
union : function ( searchA , searchB ) {
57
- if ( searchA . value . includes ( searchB . value ) ) {
61
+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
58
62
return searchB ;
59
63
}
60
- if ( searchB . value . includes ( searchA . value ) ) {
64
+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
61
65
return searchA ;
62
66
}
63
67
return new QueryLogic . ValuesOr ( [ searchA , searchB ] ) ;
64
68
} ,
65
69
// a aa
66
70
intersection : function ( searchA , searchB ) {
67
- if ( searchA . value . includes ( searchB . value ) ) {
71
+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
68
72
return searchA ;
69
73
}
70
- if ( searchB . value . includes ( searchA . value ) ) {
74
+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
71
75
return searchB ;
72
76
}
73
77
return QueryLogic . UNDEFINABLE ;
74
78
} ,
75
79
difference : function ( searchA , searchB ) {
76
80
// if a is a subset
77
- if ( searchA . value . includes ( searchB . value ) ) {
81
+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
78
82
return QueryLogic . EMPTY ;
79
83
}
80
84
// a is a superset
81
- if ( searchB . value . includes ( searchA . value ) ) {
85
+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
82
86
return QueryLogic . UNDEFINABLE ;
83
87
}
84
88
// foo \ bar
0 commit comments