Skip to content

Commit

Permalink
remove classList from unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 13, 2014
1 parent 75d200c commit 11e1a25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 99 deletions.
1 change: 0 additions & 1 deletion test/unit/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<!-- include test utilities -->
<script src="utils/mocha.js"></script>
<script src="utils/chai.js"></script>
<script src="utils/classList.js"></script>
<script src="utils/prepare.js"></script>

<!-- specs -->
Expand Down
15 changes: 10 additions & 5 deletions test/unit/specs/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,27 @@ describe('UNIT: Directives', function () {

describe('class', function () {

function contains (el, cls) {
var cur = ' ' + el.className + ' '
return cur.indexOf(' ' + cls + ' ') > -1
}

it('should set class to the value if it has no arg', function () {
var dir = mockDirective('class')
dir.update('test')
assert.ok(dir.el.classList.contains('test'))
assert.ok(contains(dir.el, 'test'))
dir.update('hoho')
assert.ok(!dir.el.classList.contains('test'))
assert.ok(dir.el.classList.contains('hoho'))
assert.ok(!contains(dir.el, 'test'))
assert.ok(contains(dir.el, 'hoho'))
})

it('should add/remove class based on truthy/falsy if it has an arg', function () {
var dir = mockDirective('class')
dir.arg = 'test'
dir.update(true)
assert.ok(dir.el.classList.contains('test'))
assert.ok(contains(dir.el, 'test'))
dir.update(false)
assert.ok(!dir.el.classList.contains('test'))
assert.ok(!contains(dir.el, 'test'))
})

})
Expand Down
93 changes: 0 additions & 93 deletions test/unit/utils/classList.js

This file was deleted.

0 comments on commit 11e1a25

Please sign in to comment.