@@ -53,7 +53,7 @@ describe('unexpected-dom', function () {
53
53
expect ( function ( ) {
54
54
expect ( el , 'to only have attributes' , 'id' ) ;
55
55
} , 'to throw exception' , function ( err ) {
56
- expect ( err . output . toString ( ) , 'to match ' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to only have attributes \'id\'' ) ;
56
+ expect ( err . output . toString ( ) , 'to be ' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to only have attributes \'id\'' ) ;
57
57
} ) ;
58
58
} ) ;
59
59
@@ -70,7 +70,7 @@ describe('unexpected-dom', function () {
70
70
expect ( function ( ) {
71
71
expect ( el , 'to have attributes' , 'id' , 'foo' ) ;
72
72
} , 'to throw exception' , function ( err ) {
73
- expect ( err . output . toString ( ) , 'to match ' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to have attributes \'id\', \'foo\'' ) ;
73
+ expect ( err . output . toString ( ) , 'to be ' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to have attributes \'id\', \'foo\'' ) ;
74
74
} ) ;
75
75
} ) ;
76
76
@@ -87,7 +87,60 @@ describe('unexpected-dom', function () {
87
87
expect ( function ( ) {
88
88
expect ( el , 'not to have attributes' , 'id' ) ;
89
89
} , 'to throw exception' , function ( err ) {
90
- expect ( err . output . toString ( ) , 'to match' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> not to have attributes \'id\'' ) ;
90
+ expect ( err . output . toString ( ) , 'to be' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> not to have attributes \'id\'' ) ;
91
+ } ) ;
92
+ } ) ;
93
+ } ) ;
94
+
95
+ describe ( 'array comparison' , function ( ) {
96
+ it ( 'should match exact arguments' , function ( ) {
97
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
98
+
99
+ expect ( this . body . firstChild , 'to only have attributes' , [ 'id' , 'class' , 'data-info' , 'disabled' ] ) ;
100
+ } ) ;
101
+
102
+ it ( 'should fail on exact arguments not met' , function ( ) {
103
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
104
+ var el = this . body . firstChild ;
105
+
106
+ expect ( function ( ) {
107
+ expect ( el , 'to only have attributes' , [ 'id' ] ) ;
108
+ } , 'to throw exception' , function ( err ) {
109
+ expect ( err . output . toString ( ) , 'to be' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to only have attributes [ \'id\' ]' ) ;
110
+ } ) ;
111
+ } ) ;
112
+
113
+ it ( 'should match partial arguments' , function ( ) {
114
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
115
+
116
+ expect ( this . body . firstChild , 'to have attributes' , [ 'id' , 'class' ] ) ;
117
+ } ) ;
118
+
119
+ it ( 'should fail on partial arguments not met' , function ( ) {
120
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
121
+ var el = this . body . firstChild ;
122
+
123
+ expect ( function ( ) {
124
+ expect ( el , 'to have attributes' , [ 'id' , 'foo' ] ) ;
125
+ } , 'to throw exception' , function ( err ) {
126
+ expect ( err . output . toString ( ) , 'to be' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> to have attributes [ \'id\', \'foo\' ]' ) ;
127
+ } ) ;
128
+ } ) ;
129
+
130
+ it ( 'should match negative arguments' , function ( ) {
131
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
132
+
133
+ expect ( this . body . firstChild , 'not to have attributes' , [ 'foo' , 'bar' ] ) ;
134
+ } ) ;
135
+
136
+ it ( 'should fail on negative partial arguments met' , function ( ) {
137
+ this . body . innerHTML = '<button id="foo" class="bar" data-info="baz" disabled>Press me</button>' ;
138
+ var el = this . body . firstChild ;
139
+
140
+ expect ( function ( ) {
141
+ expect ( el , 'not to have attributes' , [ 'id' ] ) ;
142
+ } , 'to throw exception' , function ( err ) {
143
+ expect ( err . output . toString ( ) , 'to be' , 'expected <button class="bar" data-info="baz" disabled="" id="foo"/> not to have attributes [ \'id\' ]' ) ;
91
144
} ) ;
92
145
} ) ;
93
146
} ) ;
0 commit comments