-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime): initialize custom elements even when there is no styles (…
…#4296) * remove top-level check gating init logic based on build flags This commit removes a check that was gating some component initialization logic. This check would force that non-lazy builds would need to have styles (or at least an empty stylesheet) for the init logic to execute that would mark the component as initialized. This flag is necessary to have set `true` for watcher callbacks to execute * add small test to check initialized flag * prettier because I don't have it auto-format spec files 🤦♂️
- Loading branch information
1 parent
acd5adf
commit 23f1e66
Showing
3 changed files
with
29 additions
and
9 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
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,22 @@ | ||
import { getHostRef } from '@platform'; | ||
import { Component } from '@stencil/core'; | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
|
||
import { HOST_FLAGS } from '../../utils'; | ||
|
||
describe('initialize component', () => { | ||
@Component({ | ||
tag: 'cmp-a', | ||
}) | ||
class CmpA {} | ||
|
||
it('should mark the component as initialized', async () => { | ||
const page = await newSpecPage({ | ||
components: [CmpA], | ||
html: `<cmp-a><cmp-a>`, | ||
}); | ||
|
||
const hostFlags = getHostRef(page.root).$flags$; | ||
expect(hostFlags & HOST_FLAGS.hasInitializedComponent).toBe(HOST_FLAGS.hasInitializedComponent); | ||
}); | ||
}); |
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