2013-11-18 09:08:20 +08:00
|
|
|
casper.test.begin('Nested Properties', 20, function (test) {
|
2013-10-29 01:22:16 +08:00
|
|
|
|
|
|
|
|
casper
|
|
|
|
|
.start('./fixtures/nested-props.html', function () {
|
|
|
|
|
|
|
|
|
|
test.assertSelectorHasText('h1 span', '')
|
|
|
|
|
test.assertSelectorHasText('h2 span', '555')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Yoyoyo555')
|
|
|
|
|
|
|
|
|
|
this.click('.one')
|
|
|
|
|
test.assertSelectorHasText('h1 span', 'one')
|
|
|
|
|
test.assertSelectorHasText('h2 span', '1')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Yoyoyoone1')
|
|
|
|
|
|
|
|
|
|
this.click('.two')
|
|
|
|
|
test.assertSelectorHasText('h1 span', 'two')
|
|
|
|
|
test.assertSelectorHasText('h2 span', '2')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Yoyoyotwo2')
|
|
|
|
|
|
|
|
|
|
this.click('.three')
|
|
|
|
|
test.assertSelectorHasText('h1 span', 'three')
|
|
|
|
|
test.assertSelectorHasText('h2 span', '3')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Yoyoyothree3')
|
|
|
|
|
|
|
|
|
|
this.fill('#form', {
|
|
|
|
|
msg: 'Oh yeah '
|
|
|
|
|
})
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Oh yeah three3')
|
|
|
|
|
|
2013-12-24 03:47:51 +08:00
|
|
|
// hidden data variables
|
2013-11-17 15:04:29 +08:00
|
|
|
// i.e. nested under an object, not explicitly
|
|
|
|
|
// bound in the template, but is depended upon
|
|
|
|
|
// by an expression or a computed property
|
|
|
|
|
test.assertSelectorHasText('.hidden', '3')
|
|
|
|
|
this.click('.four')
|
|
|
|
|
test.assertSelectorHasText('.hidden', '4')
|
|
|
|
|
|
2013-11-18 09:08:20 +08:00
|
|
|
// set a nested object to {}
|
|
|
|
|
this.click('.empty1')
|
|
|
|
|
test.assertSelectorHasText('h1 span', '')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Oh yeah 3')
|
|
|
|
|
|
|
|
|
|
this.click('.empty2')
|
|
|
|
|
test.assertSelectorHasText('h1 span', '')
|
|
|
|
|
test.assertSelectorHasText('h2 span', '')
|
|
|
|
|
test.assertSelectorHasText('h3 span', 'Oh yeah ')
|
|
|
|
|
|
2013-10-29 01:22:16 +08:00
|
|
|
})
|
|
|
|
|
.run(function () {
|
|
|
|
|
test.done()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
})
|