mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
chore(): sync with main
This commit is contained in:
43
core/src/components/toggle/test/toggle.spec.ts
Normal file
43
core/src/components/toggle/test/toggle.spec.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { newSpecPage } from '@stencil/core/testing';
|
||||
|
||||
import { config } from '../../../global/config';
|
||||
import { Toggle } from '../toggle';
|
||||
|
||||
describe('toggle', () => {
|
||||
beforeEach(() => {
|
||||
config.reset({});
|
||||
});
|
||||
|
||||
const newToggle = async (): Promise<Toggle> => {
|
||||
const { rootInstance } = await newSpecPage({
|
||||
components: [Toggle],
|
||||
html: `<ion-toggle></ion-toggle>`,
|
||||
});
|
||||
return rootInstance;
|
||||
};
|
||||
|
||||
describe('enableOnOffLabels', () => {
|
||||
it('should disable on/off labels when setting to false on component', async () => {
|
||||
const t = await newToggle();
|
||||
t.enableOnOffLabels = false;
|
||||
config.reset({
|
||||
toggleOnOffLabels: true,
|
||||
});
|
||||
expect(t.enableOnOffLabels).toBe(false);
|
||||
});
|
||||
|
||||
it('should enable on/off labels when setting to true on global config', async () => {
|
||||
config.reset({
|
||||
toggleOnOffLabels: true,
|
||||
});
|
||||
const t = await newToggle();
|
||||
expect(t.enableOnOffLabels).toBe(true);
|
||||
});
|
||||
|
||||
it('should enable on/off labels when setting to true on component', async () => {
|
||||
const t = await newToggle();
|
||||
t.enableOnOffLabels = true;
|
||||
expect(t.enableOnOffLabels).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user