From ba5ede599a9e7b3991c235a8ae0d9c5efefeaa3e Mon Sep 17 00:00:00 2001 From: Jacob Wright Date: Thu, 23 Aug 2018 17:23:55 -0600 Subject: [PATCH] Allows actions to use any expression type Allow any expression to pass data to an action. Added a test for a ternary statement and a string template. Fixes #1676 --- src/parse/read/directives.ts | 5 +++-- .../action-ternary-template/_config.js | 20 ++++++++++++++++++ .../samples/action-ternary-template/main.html | 21 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 test/runtime/samples/action-ternary-template/_config.js create mode 100644 test/runtime/samples/action-ternary-template/main.html diff --git a/src/parse/read/directives.ts b/src/parse/read/directives.ts index 62a249a158..a1d71a7ef6 100644 --- a/src/parse/read/directives.ts +++ b/src/parse/read/directives.ts @@ -77,7 +77,7 @@ const DIRECTIVES: Record + `, + + test ( assert, component, target, window ) { + const header = target.querySelector( 'h1' ); + const eventClick = new window.MouseEvent( 'click' ); + + header.dispatchEvent( eventClick ); + assert.htmlEqual( target.innerHTML, ` +

Hello World!

+ ` ); + } +}; diff --git a/test/runtime/samples/action-ternary-template/main.html b/test/runtime/samples/action-ternary-template/main.html new file mode 100644 index 0000000000..58e19e28f4 --- /dev/null +++ b/test/runtime/samples/action-ternary-template/main.html @@ -0,0 +1,21 @@ +

+ + \ No newline at end of file