File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
fixtures/dom/src/components/fixtures/custom-elements Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import TestCase from '../../TestCase';
4
4
const React = window . React ;
5
5
const ReactDOM = window . ReactDOM ;
6
6
7
+ const supportsCustomElements = typeof customElements !== 'undefined' ;
8
+
7
9
class HelloWorld extends React . Component {
8
10
render ( ) {
9
11
return < h1 > Hello, world!</ h1 > ;
@@ -27,7 +29,9 @@ return class MyElement extends HTMLElement {
27
29
}`
28
30
) ( React , ReactDOM , HelloWorld ) ;
29
31
30
- customElements . define ( 'my-element' , MyElement ) ;
32
+ if ( supportsCustomElements ) {
33
+ customElements . define ( 'my-element' , MyElement ) ;
34
+ }
31
35
32
36
export default class ButtonTestCases extends React . Component {
33
37
render ( ) {
@@ -39,7 +43,11 @@ export default class ButtonTestCases extends React.Component {
39
43
< TestCase . ExpectedResult >
40
44
You should see "Hello, World" printed below.{ ' ' }
41
45
</ TestCase . ExpectedResult >
42
- < my-element />
46
+ { supportsCustomElements
47
+ ? < my-element />
48
+ : < div >
49
+ This browser does not support custom elements.
50
+ </ div > }
43
51
</ TestCase >
44
52
</ FixtureSet >
45
53
) ;
You can’t perform that action at this time.
0 commit comments