-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: lint, format
- Loading branch information
Showing
5 changed files
with
161 additions
and
4 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
80 changes: 80 additions & 0 deletions
80
packages/components/src/components/toggle-group/__snapshots__/toggle-group.spec.ts.snap
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,80 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Toggle Group snapshots default props 1`] = ` | ||
<scale-toggle-group> | ||
<mock:shadow-root> | ||
<div class="toggle-group toggle-group--inline" part="toggle-group inline"> | ||
<slot></slot> | ||
</div> | ||
</mock:shadow-root> | ||
<scale-toggle-button disabled="false" radius="left" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" radius="right" selected="" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
</scale-toggle-group> | ||
`; | ||
|
||
exports[`Toggle Group snapshots disabled 1`] = ` | ||
<scale-toggle-group aria-label="Aria Label" disabled=""> | ||
<mock:shadow-root> | ||
<div class="toggle-group toggle-group--inline" part="toggle-group inline"> | ||
<slot></slot> | ||
</div> | ||
</mock:shadow-root> | ||
<scale-toggle-button disabled="disabled" radius="left" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="disabled" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="disabled" radius="right" selected="" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
</scale-toggle-group> | ||
`; | ||
|
||
exports[`Toggle Group snapshots size small, multi false 1`] = ` | ||
<scale-toggle-group multi="false" size="small"> | ||
<mock:shadow-root> | ||
<div class="toggle-group toggle-group--inline" part="toggle-group inline"> | ||
<slot></slot> | ||
</div> | ||
</mock:shadow-root> | ||
<scale-toggle-button disabled="false" radius="left" size="small" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" size="small" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" radius="right" selected="" size="small" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
</scale-toggle-group> | ||
`; | ||
|
||
exports[`Toggle Group snapshots styles 1`] = ` | ||
<scale-toggle-group styles="color:red"> | ||
<mock:shadow-root> | ||
<style> | ||
color:red | ||
</style> | ||
<div class="toggle-group toggle-group--inline" part="toggle-group inline"> | ||
<slot></slot> | ||
</div> | ||
</mock:shadow-root> | ||
<scale-toggle-button disabled="false" radius="left" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
<scale-toggle-button disabled="false" radius="right" selected="" size="large" variant="primary"> | ||
Click Me! | ||
</scale-toggle-button> | ||
</scale-toggle-group> | ||
`; |
78 changes: 78 additions & 0 deletions
78
packages/components/src/components/toggle-group/toggle-group.spec.ts
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,78 @@ | ||
/** | ||
* @license | ||
* Scale https://github.com/telekom/scale | ||
* | ||
* Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import { newSpecPage, SpecPage } from '@stencil/core/testing'; | ||
import { ToggleGroup } from './toggle-group'; | ||
|
||
describe('Toggle Group', () => { | ||
let page: SpecPage; | ||
describe('snapshots', () => { | ||
it('default props', async () => { | ||
page = await newSpecPage({ | ||
components: [ToggleGroup], | ||
html: `<scale-toggle-group> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button selected>Click Me!</scale-toggle-button> | ||
</scale-toggle-group>`, | ||
}); | ||
expect(page.root).toMatchSnapshot(); | ||
}); | ||
it('size small, multi false', async () => { | ||
page = await newSpecPage({ | ||
components: [ToggleGroup], | ||
html: `<scale-toggle-group size="small" multi="false"> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button selected>Click Me!</scale-toggle-button> | ||
</scale-toggle-group>`, | ||
}); | ||
expect(page.root).toMatchSnapshot(); | ||
}); | ||
it('disabled', async () => { | ||
page = await newSpecPage({ | ||
components: [ToggleGroup], | ||
html: `<scale-toggle-group disabled aria-label="Aria Label"> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button selected>Click Me!</scale-toggle-button> | ||
</scale-toggle-group>`, | ||
}); | ||
expect(page.root).toMatchSnapshot(); | ||
}); | ||
it('styles', async () => { | ||
page = await newSpecPage({ | ||
components: [ToggleGroup], | ||
html: `<scale-toggle-group styles="color:red"> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button>Click Me!</scale-toggle-button> | ||
<scale-toggle-button selected>Click Me!</scale-toggle-button> | ||
</scale-toggle-group>`, | ||
}); | ||
expect(page.root).toMatchSnapshot(); | ||
}); | ||
}); | ||
describe('classes', () => { | ||
it('should handle getCssClassMap() and getBasePartMap()', () => { | ||
const element = new ToggleGroup(); | ||
expect(element.getCssClassMap()).toContain('toggle-group'); | ||
expect(element.getCssClassMap()).toContain('toggle-group--inline'); | ||
expect(element.getCssClassMap()).not.toContain('toggle-group--border'); | ||
|
||
expect(element.getBasePartMap()).toContain('toggle-group'); | ||
expect(element.getBasePartMap()).toContain('inline'); | ||
expect(element.getBasePartMap()).not.toContain('border'); | ||
element.border = true; | ||
expect(element.getCssClassMap()).toContain('toggle-group--border'); | ||
expect(element.getBasePartMap()).toContain('border'); | ||
}); | ||
}); | ||
}); |
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