-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/toggle): toggle disable style (#356)
Co-authored-by: Daniel Leroux <daniel.leroux@siemens.com>
- Loading branch information
1 parent
38f55dc
commit 5c4faf8
Showing
10 changed files
with
92 additions
and
8 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
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
21 changes: 21 additions & 0 deletions
21
packages/core/src/components/toggle/test/disabled/index.html
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,21 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2022 Siemens AG | ||
SPDX-License-Identifier: MIT | ||
--> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" | ||
/> | ||
<title>Stencil Component Starter</title> | ||
</head> | ||
<body style="padding: 2rem"> | ||
<ix-toggle text-off="Offline" text-on="Online" disabled checked></ix-toggle> | ||
<ix-toggle text-off="Offline" text-on="Online" disabled></ix-toggle> | ||
<script src="http://127.0.0.1:8080/scripts/e2e/load-e2e-runtime.js"></script> | ||
</body> | ||
</html> |
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
Binary file added
BIN
+8.38 KB
...ggle.e2e.ts-snapshots/toggle-disabled-1-chromium---theme-classic-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.19 KB
...gle.e2e.ts-snapshots/toggle-disabled-1-chromium---theme-classic-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,57 @@ | ||
/* | ||
* 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. | ||
*/ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 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 { newSpecPage, SpecPage } from '@stencil/core/testing'; | ||
import { CuiToggle } from '../toggle'; | ||
|
||
describe('ix-toggle', () => { | ||
let page: SpecPage; | ||
|
||
it('should toggle', async () => { | ||
page = await newSpecPage({ | ||
components: [CuiToggle], | ||
html: '<ix-toggle></ix-toggle>', | ||
}); | ||
|
||
await page.waitForChanges(); | ||
|
||
( | ||
page.doc.querySelector('ix-toggle > label > input') as HTMLElement | ||
).dispatchEvent(new Event('change')); | ||
await page.waitForChanges(); | ||
|
||
expect(page.doc.querySelector('ix-toggle').checked).toBeTruthy(); | ||
expect(page.doc.querySelector('ix-toggle').className).toContain('checked'); | ||
}); | ||
|
||
it('should be disabled', async () => { | ||
page = await newSpecPage({ | ||
components: [CuiToggle], | ||
html: '<ix-toggle disabled></ix-toggle>', | ||
}); | ||
|
||
await page.waitForChanges(); | ||
|
||
( | ||
page.doc.querySelector('ix-toggle > label > input') as HTMLElement | ||
).dispatchEvent(new Event('change')); | ||
await page.waitForChanges(); | ||
|
||
expect(page.doc.querySelector('ix-toggle').checked).toBeFalsy(); | ||
expect(page.doc.querySelector('ix-toggle').className).toContain('disabled'); | ||
}); | ||
}); |
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