File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -300,6 +300,13 @@ module.exports = function (grunt) {
300300 value : 'class none'
301301 }
302302 } ,
303+ {
304+ hasClass : {
305+ selector : 'div' ,
306+ value : 'class !none' ,
307+ allRequired : true
308+ }
309+ } ,
303310 {
304311 selectOptionByIndex : {
305312 selector : 'select' ,
Original file line number Diff line number Diff line change 1+ < << << << HEAD
2+ 'use strict' ;
3+
4+ module . exports = {
5+ detect : function ( command ) {
6+ return ! ! command . hasClass ;
7+ } ,
8+
9+ perform : function ( grunt , target , client , command ) {
10+ const hasClass = command . hasClass ,
11+ selector = hasClass . selector ,
12+ expected = hasClass . value || '' ,
13+ expectedList = expected . split ( / + / ) ;
14+ grunt . log . ok ( 'Looking for classes "' + expected + '" at "' +
15+ selector + '".' ) ;
16+ return client . getAttribute ( selector , 'class' )
17+ . then ( function ( actual ) {
18+ const actualList = ( actual || '' ) . split ( / + / ) ,
19+ method = hasClass . allRequired ? 'every' : 'some' ;
20+ if ( ! expectedList [ method ] ( function ( expected ) {
21+ return expected . startsWith ( '!' ) ?
22+ actualList . indexOf ( expected . substr ( 1 ) ) < 0 :
23+ actualList . indexOf ( expected ) >= 0 ;
24+ } ) ) {
25+ throw new Error ( 'Classes "' + expected +
26+ '" did not match classes "' + actual + '" at "' + selector + '".' ) ;
27+ }
28+ } ) ;
29+ }
30+ } ;
31+ || || || | merged common ancestors
32+ === = ===
133'use strict' ;
234
335module . exports = {
@@ -26,3 +58,4 @@ module.exports = {
2658 } ) ;
2759 }
2860} ;
61+ > >>> >>> ed18031946de405cd074c973e2461622016d7c31
You can’t perform that action at this time.
0 commit comments