File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,26 @@ define([
1111 "conditional" : function ( ) {
1212 var matches = esquery ( conditional , 'ExpressionStatement:has([name="foo"][type="Identifier"])' ) ;
1313 assert . isEqual ( 1 , matches . length ) ;
14+ } ,
15+
16+ "one of" : function ( ) {
17+ var matches = esquery ( conditional , 'IfStatement:has(LogicalExpression [name="foo"], LogicalExpression [name="x"])' ) ;
18+ assert . isEqual ( 1 , matches . length ) ;
19+ } ,
20+
21+ "chaining" : function ( ) {
22+ var matches = esquery ( conditional , 'BinaryExpression:has(Identifier[name="x"]):has(Literal[value="test"])' ) ;
23+ assert . isEqual ( 1 , matches . length ) ;
24+ } ,
25+
26+ "nesting" : function ( ) {
27+ var matches = esquery ( conditional , 'Program:has(IfStatement:has(Literal[value=true], Literal[value=false]))' ) ;
28+ assert . isEqual ( 1 , matches . length ) ;
29+ } ,
30+
31+ "non-matching" : function ( ) {
32+ var matches = esquery ( conditional , ':has([value="impossible"])' ) ;
33+ assert . isEqual ( 0 , matches . length ) ;
1434 }
1535
1636 } ) ;
You can’t perform that action at this time.
0 commit comments