Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: pkg/polymer/test/build/linter_test.dart

Issue 303003003: Fix 19029: handle special case when on-handler is empty in polymer, add better (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | pkg/polymer/test/build/script_compactor_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/build/linter_test.dart
diff --git a/pkg/polymer/test/build/linter_test.dart b/pkg/polymer/test/build/linter_test.dart
index e066960d7a95b274c7014f79bebe067a099708b9..4fa25ae8d2a3a58fd7c4c9dd58e041436f10dc07 100644
--- a/pkg/polymer/test/build/linter_test.dart
+++ b/pkg/polymer/test/build/linter_test.dart
@@ -323,7 +323,7 @@ void main() {
}, [
'warning: Event handler "onfoo" will be interpreted as an inline '
'JavaScript event handler. Use the form '
- 'on-event-name="handlerName" if you want a Dart handler '
+ 'on-event-name="{{handlerName}}" if you want a Dart handler '
'that will automatically update the UI based on model changes. '
'(lib/test.html 1 5)'
]);
@@ -340,19 +340,43 @@ void main() {
_testLinter('on-foo is not an expression', {
'a|lib/test.html': '''<html><body>
- <polymer-element name="x-a"><div on-foo="bar()"></div>
+ <polymer-element name="x-a"><div on-foo="{{bar()}}"></div>
</polymer-element>
'''.replaceAll(' ', ''),
}, [
- 'warning: Invalid event handler body "bar()". Declare a method '
+ 'warning: Invalid event handler body "{{bar()}}". Declare a method '
'in your custom element "void handlerName(event, detail, target)" '
- 'and use the form on-foo="handlerName". '
+ 'and use the form on-foo="{{handlerName}}". '
+ '(lib/test.html 1 33)'
+ ]);
+
+ _testLinter('on-foo can\'t be empty', {
+ 'a|lib/test.html': '''<html><body>
+ <polymer-element name="x-a"><div on-foo="{{}}"></div>
+ </polymer-element>
+ '''.replaceAll(' ', ''),
+ }, [
+ 'warning: Invalid event handler body "{{}}". Declare a method '
+ 'in your custom element "void handlerName(event, detail, target)" '
+ 'and use the form on-foo="{{handlerName}}". '
+ '(lib/test.html 1 33)'
+ ]);
+
+ _testLinter('on-foo can\'t be empty', {
+ 'a|lib/test.html': '''<html><body>
+ <polymer-element name="x-a"><div on-foo="{{ }}"></div>
+ </polymer-element>
+ '''.replaceAll(' ', ''),
+ }, [
+ 'warning: Invalid event handler body "{{ }}". Declare a method '
+ 'in your custom element "void handlerName(event, detail, target)" '
+ 'and use the form on-foo="{{handlerName}}". '
'(lib/test.html 1 33)'
]);
_testLinter('on-foo-bar is supported as a custom event name', {
'a|lib/test.html': '''<html><body>
- <polymer-element name="x-a"><div on-foo-bar="quux"></div>
+ <polymer-element name="x-a"><div on-foo-bar="{{quux}}"></div>
</polymer-element>
'''.replaceAll(' ', ''),
}, []);
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | pkg/polymer/test/build/script_compactor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698