Skip to content

Commit

Permalink
Add new example page to test call/nosuchmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
clairesarsam-wf committed Jun 19, 2017
1 parent 3dce4a5 commit 38f6b07
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
44 changes: 44 additions & 0 deletions example/test/call_and_nosuchmethod_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import "dart:html";

import "package:react/react_dom.dart" as react_dom;
import "package:react/react.dart" as react;
import "package:react/react_client.dart";


class _CustomComponent extends react.Component {
render() {
return react.div({}, props['children']);
}
}

var customComponent = react.registerComponent(() => new _CustomComponent());

void main() {
setClientConfiguration();

react_dom.render(
react.div({}, [
react.div({'key': 'noChildren'}),
react.div({'key': 'emptyList'}, []),
react.div({'key': 'singleItemInList'}, [react.div({})]), // This should produce a key warning
react.div({'key': 'twoItemsInList'}, [react.div({}), react.div({})]), // This should produce a key warning
react.div({'key': 'oneVariadicChild'}, react.div({})),

// These tests of variadic children won't pass in the ddc until https://github.com/dart-lang/sdk/issues/29904
// is resolved.
// react.div({'key': 'twoVariadicChildren'}, react.div({}), react.div({})),
// react.div({'key': 'fiveVariadicChildren'}, '', react.div({}), '', react.div({}), ''),

customComponent({'key': 'noChildren2'}),
customComponent({'key': 'emptyList2'}, []),
customComponent({'key': 'singleItemInList2'}, [customComponent({})]), // This should produce a key warning
customComponent({'key': 'twoItemsInList2'}, [customComponent({}), customComponent({})]), // This should produce a key warning
customComponent({'key': 'oneVariadicChild2'}, customComponent({'key': '1'})),

// These tests of variadic children won't pass in the ddc until https://github.com/dart-lang/sdk/issues/29904
// is resolved.
// customComponent({'key': 'twoVariadicChildren2'}, customComponent({}), customComponent({})),
// customComponent({'key': 'fiveVariadicChildren2'}, '', customComponent({}), '', customComponent({}), ''),
])
, querySelector('#content'));
}
17 changes: 17 additions & 0 deletions example/test/call_and_nosuchmethod_test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>

<html>
<head>
<title>call_and_nosuchmethod_test</title>
</head>

<body>
<div id="content"></div>

<script src="packages/react/react.js"></script>
<script src="packages/react/react_dom.js"></script>
<script type="application/dart" src="call_and_nosuchmethod_test.dart"></script>
<!-- for this next line to work, your pubspec.yaml file must have a dependency on 'browser' -->
<script src="packages/browser/dart.js"></script>
</body>
</html>

0 comments on commit 38f6b07

Please sign in to comment.