11var QueryLogic = require ( "../can-query-logic" ) ;
22var QUnit = require ( "steal-qunit" ) ;
33var canReflect = require ( "can-reflect" ) ;
4+ var canSymbol = require ( "can-symbol" ) ;
45
56QUnit . module ( "can-query-logic special comparison logic" ) ;
67
@@ -34,6 +35,10 @@ QUnit.test("where to filter", function(){
3435 } , "got intersection" ) ;
3536} ) ;
3637
38+ var stringIncludes = function ( strA , strB ) {
39+ return strA . indexOf ( strB ) >= 0 ;
40+ } ;
41+
3742QUnit . test ( "Searchable string" , function ( ) {
3843 // Create a set type that is used to do comparisons.
3944 function SearchableStringSet ( value ) {
@@ -43,7 +48,7 @@ QUnit.test("Searchable string", function(){
4348 canReflect . assignSymbols ( SearchableStringSet . prototype , {
4449 // Returns if the name on a todo is actually a member of the set.
4550 "can.isMember" : function ( value ) {
46- return value . includes ( this . value ) ;
51+ return stringIncludes ( value , this . value ) ;
4752 } ,
4853 "can.serialize" : function ( ) {
4954 return this . value ;
@@ -53,31 +58,31 @@ QUnit.test("Searchable string", function(){
5358 // Specify how to do the fundamental set comparisons.
5459 QueryLogic . defineComparison ( SearchableStringSet , SearchableStringSet , {
5560 union : function ( searchA , searchB ) {
56- if ( searchA . value . includes ( searchB . value ) ) {
61+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
5762 return searchB ;
5863 }
59- if ( searchB . value . includes ( searchA . value ) ) {
64+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
6065 return searchA ;
6166 }
6267 return new QueryLogic . ValuesOr ( [ searchA , searchB ] ) ;
6368 } ,
6469 // a aa
6570 intersection : function ( searchA , searchB ) {
66- if ( searchA . value . includes ( searchB . value ) ) {
71+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
6772 return searchA ;
6873 }
69- if ( searchB . value . includes ( searchA . value ) ) {
74+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
7075 return searchB ;
7176 }
7277 return QueryLogic . UNDEFINABLE ;
7378 } ,
7479 difference : function ( searchA , searchB ) {
7580 // if a is a subset
76- if ( searchA . value . includes ( searchB . value ) ) {
81+ if ( stringIncludes ( searchA . value , searchB . value ) ) {
7782 return QueryLogic . EMPTY ;
7883 }
7984 // a is a superset
80- if ( searchB . value . includes ( searchA . value ) ) {
85+ if ( stringIncludes ( searchB . value , searchA . value ) ) {
8186 return QueryLogic . UNDEFINABLE ;
8287 }
8388 // foo \ bar
@@ -100,7 +105,7 @@ QUnit.test("Searchable string", function(){
100105
101106 }
102107
103- SearchableString [ Symbol . for ( "can.SetType" ) ] = SearchableStringSet ;
108+ SearchableString [ canSymbol . for ( "can.SetType" ) ] = SearchableStringSet ;
104109
105110 var todoQueryLogic = new QueryLogic ( {
106111 keys : {
0 commit comments