diff --git a/src/generators/Generator.ts b/src/generators/Generator.ts
index 99f7597276c1..44b93f85c528 100644
--- a/src/generators/Generator.ts
+++ b/src/generators/Generator.ts
@@ -755,6 +755,11 @@ export default class Generator {
});
this.skip();
}
+
+ if (node.type === 'Transition' && node.expression) {
+ node.metadata = contextualise(node.expression, contextDependencies, indexes);
+ this.skip();
+ }
},
leave(node: Node, parent: Node) {
diff --git a/src/generators/dom/visitors/Element/addTransitions.ts b/src/generators/dom/visitors/Element/addTransitions.ts
index 26ff6f048ec2..10d0b90f50bd 100644
--- a/src/generators/dom/visitors/Element/addTransitions.ts
+++ b/src/generators/dom/visitors/Element/addTransitions.ts
@@ -21,7 +21,7 @@ export default function addTransitions(
if (intro === outro) {
const name = block.getUniqueName(`${node.var}_transition`);
const snippet = intro.expression
- ? intro.expression.metadata.snippet
+ ? intro.metadata.snippet
: '{}';
block.addVariable(name);
@@ -51,7 +51,7 @@ export default function addTransitions(
if (intro) {
block.addVariable(introName);
const snippet = intro.expression
- ? intro.expression.metadata.snippet
+ ? intro.metadata.snippet
: '{}';
const fn = `%transitions-${intro.name}`; // TODO add built-in transitions?
@@ -76,7 +76,7 @@ export default function addTransitions(
if (outro) {
block.addVariable(outroName);
const snippet = outro.expression
- ? intro.expression.metadata.snippet
+ ? outro.metadata.snippet
: '{}';
const fn = `%transitions-${outro.name}`;
diff --git a/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js b/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js
index bff66c903b2a..a0ef755fb64e 100644
--- a/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js
+++ b/test/runtime/samples/binding-input-checkbox-group-outside-each/_config.js
@@ -10,19 +10,17 @@ export default {
selected: [ values[1] ]
},
- 'skip-ssr': true, // values are rendered as [object Object]
-
html: `
Beta
`,
@@ -40,15 +38,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Alpha, Beta
@@ -61,15 +59,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Beta, Gamma
diff --git a/test/runtime/samples/binding-input-checkbox-group/_config.js b/test/runtime/samples/binding-input-checkbox-group/_config.js
index bff66c903b2a..a0ef755fb64e 100644
--- a/test/runtime/samples/binding-input-checkbox-group/_config.js
+++ b/test/runtime/samples/binding-input-checkbox-group/_config.js
@@ -10,19 +10,17 @@ export default {
selected: [ values[1] ]
},
- 'skip-ssr': true, // values are rendered as [object Object]
-
html: `
Beta
`,
@@ -40,15 +38,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Alpha, Beta
@@ -61,15 +59,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Beta, Gamma
diff --git a/test/runtime/samples/binding-input-radio-group/_config.js b/test/runtime/samples/binding-input-radio-group/_config.js
index b5574965335f..b88dd10d4c97 100644
--- a/test/runtime/samples/binding-input-radio-group/_config.js
+++ b/test/runtime/samples/binding-input-radio-group/_config.js
@@ -10,19 +10,17 @@ export default {
selected: values[1]
},
- 'skip-ssr': true, // values are rendered as [object Object]
-
html: `
Beta
`,
@@ -40,15 +38,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Alpha
@@ -65,15 +63,15 @@ export default {
assert.htmlEqual( target.innerHTML, `
Gamma
diff --git a/test/runtime/samples/transition-js-parameterised/_config.js b/test/runtime/samples/transition-js-parameterised/_config.js
new file mode 100644
index 000000000000..d12aa06b89fb
--- /dev/null
+++ b/test/runtime/samples/transition-js-parameterised/_config.js
@@ -0,0 +1,17 @@
+export default {
+ test(assert, component, target, window, raf) {
+ component.set({ visible: true });
+ const div = target.querySelector('div');
+ assert.equal(div.foo, 0);
+
+ raf.tick(50);
+ assert.equal(div.foo, 100);
+
+ raf.tick(100);
+ assert.equal(div.foo, 200);
+
+ raf.tick(101);
+
+ component.destroy();
+ },
+};
diff --git a/test/runtime/samples/transition-js-parameterised/main.html b/test/runtime/samples/transition-js-parameterised/main.html
new file mode 100644
index 000000000000..de713ae96320
--- /dev/null
+++ b/test/runtime/samples/transition-js-parameterised/main.html
@@ -0,0 +1,18 @@
+{{#if visible}}
+ fades in
+{{/if}}
+
+
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index ae736a946c17..4a8c3799e3b7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10,7 +10,7 @@
version "8.0.53"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
-"@types/node@^7.0.18", "@types/node@^7.0.48":
+"@types/node@^7.0.18":
version "7.0.48"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.48.tgz#24bfdc0aa82e8f6dbd017159c58094a2e06d0abb"
@@ -64,8 +64,8 @@ ajv@^4.9.1:
json-stable-stringify "^1.0.1"
ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0:
- version "5.4.0"
- resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.4.0.tgz#32d1cf08dbc80c432f426f12e10b2511f6b46474"
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.0.tgz#eb2840746e9dc48bd5e063a36e3fd400c5eab5a9"
dependencies:
co "^4.6.0"
fast-deep-equal "^1.0.0"
@@ -441,8 +441,8 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0:
supports-color "^4.0.0"
chardet@^0.4.0:
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.0.tgz#0bbe1355ac44d7a3ed4a925707c4ef70f8190f6c"
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
chokidar@^1.7.0:
version "1.7.0"
@@ -538,10 +538,8 @@ commander@2.9.0:
graceful-readlink ">= 1.0.0"
commander@^2.9.0:
- version "2.12.0"
- resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.0.tgz#2f13615c39c687a77926aa68ef25c099db1e72fb"
- dependencies:
- "@types/node" "^7.0.48"
+ version "2.12.1"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.1.tgz#468635c4168d06145b9323356d1da84d14ac4a7a"
commondir@^1.0.1:
version "1.0.1"
@@ -580,8 +578,8 @@ content-type-parser@^1.0.1:
resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7"
convert-source-map@^1.3.0:
- version "1.5.0"
- resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5"
core-js@^2.4.0:
version "2.5.1"
@@ -744,12 +742,11 @@ doctrine@1.5.0:
esutils "^2.0.2"
isarray "^1.0.0"
-doctrine@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63"
+doctrine@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075"
dependencies:
esutils "^2.0.2"
- isarray "^1.0.0"
dom-serializer@0:
version "0.1.0"
@@ -890,8 +887,8 @@ eslint-scope@^3.7.1:
estraverse "^4.1.1"
eslint@^4.3.0:
- version "4.11.0"
- resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.11.0.tgz#39a8c82bc0a3783adf5a39fa27fdd9d36fac9a34"
+ version "4.12.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.12.0.tgz#a7ce78eba8cc8f2443acfbbc870cc31a65135884"
dependencies:
ajv "^5.3.0"
babel-code-frame "^6.22.0"
@@ -899,7 +896,7 @@ eslint@^4.3.0:
concat-stream "^1.6.0"
cross-spawn "^5.1.0"
debug "^3.0.1"
- doctrine "^2.0.0"
+ doctrine "^2.0.2"
eslint-scope "^3.7.1"
espree "^3.5.2"
esquery "^1.0.0"
@@ -908,7 +905,7 @@ eslint@^4.3.0:
file-entry-cache "^2.0.0"
functional-red-black-tree "^1.0.1"
glob "^7.1.2"
- globals "^9.17.0"
+ globals "^11.0.1"
ignore "^3.3.3"
imurmurhash "^0.1.4"
inquirer "^3.0.6"
@@ -1272,7 +1269,11 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2:
once "^1.3.0"
path-is-absolute "^1.0.0"
-globals@^9.17.0, globals@^9.18.0:
+globals@^11.0.1:
+ version "11.0.1"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-11.0.1.tgz#12a87bb010e5154396acc535e1e43fc753b0e5e8"
+
+globals@^9.18.0:
version "9.18.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a"
@@ -1723,8 +1724,8 @@ jsbn@~0.1.0:
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
jsdom@^11.1.0:
- version "11.4.0"
- resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.4.0.tgz#a3941a9699cbb0d61f8ab86f6f28f4ad5ea60d04"
+ version "11.5.1"
+ resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.5.1.tgz#5df753b8d0bca20142ce21f4f6c039f99a992929"
dependencies:
abab "^1.0.3"
acorn "^5.1.2"
@@ -1737,6 +1738,7 @@ jsdom@^11.1.0:
domexception "^1.0.0"
escodegen "^1.9.0"
html-encoding-sniffer "^1.0.1"
+ left-pad "^1.2.0"
nwmatcher "^1.4.3"
parse5 "^3.0.2"
pn "^1.0.0"
@@ -1839,6 +1841,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
+left-pad@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee"
+
levn@^0.3.0, levn@~0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"