-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new example page to test call/nosuchmethod
- Loading branch information
1 parent
3dce4a5
commit 38f6b07
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |