-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add font size prop into icon component (#379)
- Loading branch information
1 parent
f7b39f4
commit d00c774
Showing
5 changed files
with
51 additions
and
22 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 |
---|---|---|
@@ -1,28 +1,32 @@ | ||
import { newSpecPage } from '@stencil/core/testing' | ||
import { SpecPage, newSpecPage } from '@stencil/core/testing' | ||
|
||
import { AtomIcon } from './icon' | ||
|
||
const URL_MOCK = 'https://atomium.juntossomosmais.com.br/icons' | ||
|
||
describe('atom-icon', () => { | ||
it('should render ion-icon element', async () => { | ||
const page = await newSpecPage({ | ||
let page: SpecPage | ||
|
||
beforeEach(async () => { | ||
page = await newSpecPage({ | ||
components: [AtomIcon], | ||
html: `<atom-icon icon="heart" color="primary" size="large"></atom-icon>`, | ||
}) | ||
}) | ||
|
||
it('should size attributte to be filed with size prop when its an enum type', () => { | ||
expect(page?.root?.shadowRoot).toEqualHtml(` | ||
<ion-icon color="primary" icon="${URL_MOCK}/heart.svg" size="large"></ion-icon> | ||
`) | ||
}) | ||
|
||
if (!page?.root?.shadowRoot) { | ||
throw new Error('page.root is undefined') | ||
} | ||
it('should style font-size to be filed with size prop when its an number type', async () => { | ||
page?.root?.setAttribute('size', '10') | ||
|
||
await page.waitForChanges() | ||
|
||
expect(page.root).toEqualHtml(` | ||
<atom-icon aria-hidden="true" color="primary" icon="heart" size="large"> | ||
<mock:shadow-root> | ||
<ion-icon color="primary" icon="${URL_MOCK}/heart.svg" size="large"></ion-icon> | ||
</mock:shadow-root> | ||
</atom-icon> | ||
expect(page?.root?.shadowRoot).toEqualHtml(` | ||
<ion-icon color="primary" icon="${URL_MOCK}/heart.svg" size="" style="font-size: 10px;"></ion-icon> | ||
`) | ||
}) | ||
}) |
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
1 change: 0 additions & 1 deletion
1
packages/core/src/components/icon/stories/icon.core.stories.tsx
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