From 79d12ad0af5555a9ff05e5fb720c21978eba8018 Mon Sep 17 00:00:00 2001 From: Tim Scanlin Date: Thu, 2 Apr 2015 22:00:18 -0700 Subject: [PATCH] make example of vm ready bug in phantom.js --- examples/nested/index.html | 28 ++++++++++++++++++++++++++++ examples/nested/nested.js | 35 +++++++++++++++++++++++++++++++++++ test/e2e/nested.js | 15 +++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 examples/nested/index.html create mode 100644 examples/nested/nested.js create mode 100644 test/e2e/nested.js diff --git a/examples/nested/index.html b/examples/nested/index.html new file mode 100644 index 00000000000..a1fbea5a531 --- /dev/null +++ b/examples/nested/index.html @@ -0,0 +1,28 @@ + + + + + Vue.js nested demo + + + + + + + + +
+ + + +
+
+
+ + + + + diff --git a/examples/nested/nested.js b/examples/nested/nested.js new file mode 100644 index 00000000000..a2530b28fff --- /dev/null +++ b/examples/nested/nested.js @@ -0,0 +1,35 @@ +// define the child component +Vue.component('child', { + template: '#child-template', + data: function () { + return { + state: { + created: false, + ready: false + } + } + }, + created: function() { + this.state.created = true + }, + ready: function() { + this.state.ready = true + } +}) + +// boot up the demo +var parent = new Vue({ + el: '#demo', + data: { + state: { + created: false, + ready: false + } + }, + created: function() { + this.state.created = true + }, + ready: function() { + this.state.ready = true + } +}) diff --git a/test/e2e/nested.js b/test/e2e/nested.js new file mode 100644 index 00000000000..e10d9c4413b --- /dev/null +++ b/test/e2e/nested.js @@ -0,0 +1,15 @@ +casper.test.begin('nested', 5, function (test) { + casper + .start('../../examples/nested/index.html') + .then(function () { + test.assertElementCount('span', 4) + test.assertSelectorHasText('span.one', 'true') + test.assertSelectorHasText('span.two', 'true') + test.assertSelectorHasText('span.three', 'true') + test.assertSelectorHasText('span.four', 'true') + }) + // run + .run(function () { + test.done() + }) +})