This repository was archived by the owner on Feb 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,4 +201,18 @@ module('Integration | index', (hooks) => {
201201
202202 await render ( hbs `<my-render data-id="bar"/>` ) ;
203203 } ) ;
204+
205+ test ( 'it can render same custom element multiple times' , async ( assert ) => {
206+ await render ( hbs `<int-my-content data-id="foo">foo</int-my-content>` ) ;
207+
208+ const foo = find ( '[data-id="foo"]' ) ;
209+
210+ foo . textContent = 'bar' ;
211+
212+ await settled ( ) ;
213+
214+ const inner = shadowFind ( 'int-my-content' , '[data-id="foo"]' ) ;
215+
216+ assert . equal ( inner . textContent . trim ( ) , 'bar' ) ;
217+ } ) ;
204218} ) ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { defineCustomElements } from 'ember-cli-web-components' ;
3+
4+ module ( 'Integration | no-component' , ( hooks ) => {
5+ hooks . beforeEach ( ( ) => {
6+ defineCustomElements ( {
7+ 'fake-component' : {
8+ name : 'fake-component'
9+ }
10+ } ) ;
11+ } ) ;
12+
13+ test ( 'it defines custom component' , ( assert ) => {
14+ const customElement = customElements . get ( 'fake-component' ) ;
15+
16+ assert . ok ( customElement ) ;
17+ } ) ;
18+
19+ test ( 'custom element can be created' , async ( assert ) => {
20+ const element = document . createElement ( 'fake-component' ) ;
21+
22+ const rootElement = document . querySelector ( '#ember-testing' ) ;
23+
24+ rootElement . appendChild ( element ) ;
25+
26+ assert . ok ( element . isConnected ) ;
27+ } ) ;
28+ } ) ;
Original file line number Diff line number Diff line change 11import { module , test } from 'qunit' ;
22import { defineCustomElements } from 'ember-cli-web-components' ;
3+ import Component from '@ember/component' ;
34
4- module ( 'Integration | no-component ' , ( hooks ) => {
5+ module ( 'Integration | no-instance ' , ( hooks ) => {
56 hooks . beforeEach ( ( ) => {
7+ define ( 'dummy/components/no-instance' , [ 'exports' ] , ( exports ) => {
8+ exports . default = Component . extend ( ) ;
9+ } ) ;
10+
611 defineCustomElements ( {
7- 'fake-component ' : {
8- name : 'fake-component '
12+ 'no-instance ' : {
13+ name : 'no-instance '
914 }
1015 } ) ;
1116 } ) ;
1217
18+ hooks . afterEach ( ( ) => {
19+ delete require ( 'dummy/components/no-instance' ) ;
20+ } ) ;
21+
1322 test ( 'it defines custom component' , ( assert ) => {
14- const customElement = customElements . get ( 'fake-component ' ) ;
23+ const customElement = customElements . get ( 'no-instance ' ) ;
1524
1625 assert . ok ( customElement ) ;
1726 } ) ;
1827
1928 test ( 'custom element can be created' , async ( assert ) => {
20- const element = document . createElement ( 'fake-component ' ) ;
29+ const element = document . createElement ( 'no-instance ' ) ;
2130
2231 const rootElement = document . querySelector ( '#ember-testing' ) ;
2332
You can’t perform that action at this time.
0 commit comments