-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/toast|react/toast|vue/toast): predefine custom elements befo…
…re usage (#1201)
- Loading branch information
1 parent
716ed56
commit 34b50ef
Showing
16 changed files
with
130 additions
and
57 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,7 @@ | ||
--- | ||
'@siemens/ix-react': patch | ||
'@siemens/ix': patch | ||
'@siemens/ix-vue': patch | ||
--- | ||
|
||
fix(core/toast|react/toast|vue/toast): predefine custom elements before usage |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Siemens AG | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { describe, it } from 'vitest'; | ||
import Content from './toast'; | ||
|
||
describe(`toast`, () => { | ||
it(`basic`, async () => { | ||
const { getByText } = render(<Content />); | ||
|
||
const button = getByText('Hallo'); | ||
button.click(); | ||
|
||
await customElements.whenDefined('ix-toast'); | ||
await customElements.whenDefined('ix-toast-container'); | ||
|
||
const toast = await screen.findByText('Foobar'); | ||
const toastShadowRoot = toast.shadowRoot; | ||
|
||
expect(toast).toBeDefined(); | ||
expect(toastShadowRoot).toBeDefined(); | ||
expect(toast.innerText).toBe('Foobar'); | ||
|
||
await customElements.whenDefined('ix-icon'); | ||
|
||
const icon = toastShadowRoot?.querySelector( | ||
'.toast-icon ix-icon' | ||
) as HTMLIxIconElement; | ||
|
||
expect(icon).toBeDefined(); | ||
|
||
await waitFor(() => { | ||
expect(icon.shadowRoot).toBeDefined(); | ||
Check failure on line 40 in packages/react/src/tests/toast/toast.spec.tsx GitHub Actions / unitsrc/tests/toast/toast.spec.tsx > toast > basic
|
||
}); | ||
|
||
expect(icon.shadowRoot).toBeDefined(); | ||
expect(icon.name).toEqual('star'); | ||
}); | ||
}); |
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,30 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Siemens AG | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { IxButton, showToast } from '../../'; | ||
|
||
const Index = () => { | ||
return ( | ||
<> | ||
<IxButton | ||
onClick={async () => { | ||
await showToast({ | ||
icon: 'star', | ||
message: 'Foobar', | ||
}); | ||
}} | ||
> | ||
Hallo | ||
</IxButton> | ||
</> | ||
); | ||
}; | ||
|
||
export default Index; |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
"cache": false | ||
}, | ||
"test": { | ||
"dependsOn": ["build"], | ||
"dependsOn": ["^build"], | ||
"cache": false | ||
} | ||
} | ||
|