mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-13 09:04:14 +02:00
Improve manipulator coverage
This commit is contained in:
@@ -41,16 +41,19 @@ $(function () {
|
||||
})
|
||||
|
||||
QUnit.test('should get data attributes', function (assert) {
|
||||
assert.expect(2)
|
||||
assert.expect(4)
|
||||
|
||||
var $div = $('<div data-test="js" data-test2="js2" />').appendTo('#qunit-fixture')
|
||||
var $div2 = $('<div data-test3="js" data-test4="js2" />').appendTo('#qunit-fixture')
|
||||
var $div3 = $('<div attri="1" />').appendTo('#qunit-fixture')
|
||||
|
||||
assert.propEqual(Manipulator.getDataAttributes($div[0]), {
|
||||
test: 'js',
|
||||
test2: 'js2'
|
||||
})
|
||||
|
||||
assert.propEqual(Manipulator.getDataAttributes(null), {})
|
||||
|
||||
var stub = sinon
|
||||
.stub(Object, 'getOwnPropertyDescriptor')
|
||||
.callsFake(function () {
|
||||
@@ -62,6 +65,8 @@ $(function () {
|
||||
test4: 'js2'
|
||||
})
|
||||
|
||||
assert.propEqual(Manipulator.getDataAttributes($div3[0]), {})
|
||||
|
||||
stub.restore()
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user