|
|
|
@ -8,8 +8,7 @@ module.exports = { |
|
|
|
describe('PropertyView', () => { |
|
|
|
|
|
|
|
var component; |
|
|
|
var $fixtures; |
|
|
|
var $fixture; |
|
|
|
var fixtures; |
|
|
|
var target; |
|
|
|
var model; |
|
|
|
var view; |
|
|
|
@ -19,11 +18,6 @@ module.exports = { |
|
|
|
var propValue = 'testvalue'; |
|
|
|
var defValue = 'testDefault'; |
|
|
|
|
|
|
|
before(() => { |
|
|
|
$fixtures = $("#fixtures"); |
|
|
|
$fixture = $('<div class="sm-fixture"></div>'); |
|
|
|
}); |
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
propTarget = Object.assign({}, Backbone.Events); |
|
|
|
target = new Component(); |
|
|
|
@ -35,9 +29,10 @@ module.exports = { |
|
|
|
propTarget |
|
|
|
}; |
|
|
|
view = new PropertyView(options); |
|
|
|
$fixture.empty().appendTo($fixtures); |
|
|
|
document.body.innerHTML = '<div id="fixtures"></div>'; |
|
|
|
fixtures = document.body.firstChild; |
|
|
|
view.render(); |
|
|
|
$fixture.html(view.el); |
|
|
|
fixtures.appendChild(view.el); |
|
|
|
}); |
|
|
|
|
|
|
|
afterEach(() => { |
|
|
|
@ -45,13 +40,12 @@ module.exports = { |
|
|
|
}); |
|
|
|
|
|
|
|
after(() => { |
|
|
|
$fixture.remove(); |
|
|
|
component = null; |
|
|
|
}); |
|
|
|
|
|
|
|
it('Rendered correctly', () => { |
|
|
|
var prop = view.el; |
|
|
|
expect($fixture.get(0).querySelector('.property')).toExist(); |
|
|
|
expect(fixtures.querySelector('.property')).toExist(); |
|
|
|
expect(prop.querySelector('.label')).toExist(); |
|
|
|
expect(prop.querySelector('.field')).toExist(); |
|
|
|
}); |
|
|
|
@ -154,9 +148,9 @@ module.exports = { |
|
|
|
model, |
|
|
|
propTarget: target |
|
|
|
}); |
|
|
|
$fixture.empty().appendTo($fixtures); |
|
|
|
fixtures.innerHTML = ''; |
|
|
|
view.render(); |
|
|
|
$fixture.html(view.el); |
|
|
|
fixtures.appendChild(view.el); |
|
|
|
}); |
|
|
|
|
|
|
|
it('updateTargetStyle', () => { |
|
|
|
@ -207,9 +201,9 @@ module.exports = { |
|
|
|
view = new PropertyView({ |
|
|
|
model |
|
|
|
}); |
|
|
|
$fixture.empty().appendTo($fixtures); |
|
|
|
fixtures.innerHTML = ''; |
|
|
|
view.render(); |
|
|
|
$fixture.html(view.el); |
|
|
|
fixtures.appendChild(view.el); |
|
|
|
}); |
|
|
|
|
|
|
|
it('Value as default', () => { |
|
|
|
|