@@ -202,6 +202,58 @@ QUnit.test('class should be removed from SVG', function(assert) {
202202 assert . notOk ( element . hasClass ( 'someClass' ) ) ;
203203} ) ;
204204
205+ QUnit . module ( 'hasClass method' ) ;
206+
207+ QUnit . test ( 'should return true if element has class' , function ( assert ) {
208+ const element = renderer ( '<div>' ) ;
209+ element . addClass ( 'someClass' ) ;
210+
211+ assert . ok ( element . hasClass ( 'someClass' ) ) ;
212+ } ) ;
213+
214+ QUnit . test ( 'should return false if element has not class' , function ( assert ) {
215+ const element = renderer ( '<div>' ) ;
216+
217+ assert . notOk ( element . hasClass ( 'someClass' ) ) ;
218+ } ) ;
219+
220+ QUnit . test ( 'should return true if element has multiple classes' , function ( assert ) {
221+ const element = renderer ( '<div>' ) ;
222+ element . addClass ( 'someClass someClass2' ) ;
223+
224+ assert . ok ( element . hasClass ( 'someClass' ) ) ;
225+ assert . ok ( element . hasClass ( 'someClass2' ) ) ;
226+ assert . notOk ( element . hasClass ( 'someClass3' ) ) ;
227+ } ) ;
228+
229+ QUnit . test ( 'should return true if one of element has class' , function ( assert ) {
230+ const fixture = document . getElementById ( 'qunit-fixture' ) ;
231+
232+ const $wrapper = renderer ( '<div>' ) . html ( '<div class="one two">1</div><div class="two three">2</div>' ) ;
233+
234+ const $allInnerElements = $wrapper . find ( 'div' ) ;
235+
236+ fixture . appendChild ( $allInnerElements . get ( 0 ) ) ;
237+
238+ assert . ok ( $allInnerElements . hasClass ( 'one' ) ) ;
239+ assert . ok ( $allInnerElements . hasClass ( 'two' ) ) ;
240+ assert . ok ( $allInnerElements . hasClass ( 'three' ) ) ;
241+ assert . notOk ( $allInnerElements . hasClass ( 'five' ) ) ;
242+ } ) ;
243+
244+ QUnit . test ( 'should return false if elements collection is empty' , function ( assert ) {
245+
246+ const $wrapper = renderer ( '<div>' ) . html ( '<div class="one two">1</div><div class="two three">2</div>' ) ;
247+
248+ const $allInnerElements = $wrapper . find ( 'h1' ) ;
249+
250+ assert . notOk ( $allInnerElements . hasClass ( 'one' ) ) ;
251+ assert . notOk ( $allInnerElements . hasClass ( 'two' ) ) ;
252+ assert . notOk ( $allInnerElements . hasClass ( 'three' ) ) ;
253+ assert . notOk ( $allInnerElements . hasClass ( 'five' ) ) ;
254+ } ) ;
255+
256+
205257QUnit . module ( 'width and height methods' ) ;
206258
207259QUnit . test ( 'width and height should take into consideration borders and paddings if box-sizing is border-box' , function ( assert ) {
0 commit comments