From 4ef2299cbd7f12f45272ddf3ac588f219e20ab5e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Jun 2017 14:46:22 -0400 Subject: [PATCH 1/2] run intro transitions on initial render (#651) --- src/generators/dom/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 2c54e573a1..9ebfdc3a61 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -249,7 +249,7 @@ export default function dom( deindent` this._fragment.create(); `} - this._fragment.mount( options.target, null ); + this._fragment.${block.hasIntroMethod ? 'intro' : 'mount'}( options.target, null ); } ${generator.hasComplexBindings && From 8de2c2c9c2368b62690cc08b9e1294f4ec141f6f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 25 Jun 2017 14:49:04 -0400 Subject: [PATCH 2/2] add test for #651 --- .../samples/transition-js-initial/_config.js | 11 +++++++++++ .../samples/transition-js-initial/main.html | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/runtime/samples/transition-js-initial/_config.js create mode 100644 test/runtime/samples/transition-js-initial/main.html diff --git a/test/runtime/samples/transition-js-initial/_config.js b/test/runtime/samples/transition-js-initial/_config.js new file mode 100644 index 0000000000..f6501ed920 --- /dev/null +++ b/test/runtime/samples/transition-js-initial/_config.js @@ -0,0 +1,11 @@ +export default { + test ( assert, component, target, window, raf ) { + const div = target.querySelector( 'div' ); + assert.equal( div.foo, 0 ); + + raf.tick(50); + assert.equal( div.foo, 0.5 ); + + component.destroy(); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/transition-js-initial/main.html b/test/runtime/samples/transition-js-initial/main.html new file mode 100644 index 0000000000..13ffdc40a8 --- /dev/null +++ b/test/runtime/samples/transition-js-initial/main.html @@ -0,0 +1,16 @@ +
+ + \ No newline at end of file