Skip to content

Commit

Permalink
fix: exports in icon component
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciomutte committed Apr 26, 2023
1 parent 7698cc5 commit 1fdcc3b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
23 changes: 21 additions & 2 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* This is an autogenerated file created by the Stencil compiler.
* It contains typing information for all components that exist in this project.
*/
import { Mode, TextFieldTypes } from "@ionic/core";
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
import { Color, Mode, TextFieldTypes } from "@ionic/core";
export { Color, Mode, TextFieldTypes } from "@ionic/core";
export { LocalJSX as JSX };
export namespace Components {
interface AtomButton {
"color": 'primary' | 'secondary';
Expand All @@ -34,6 +33,11 @@ export namespace Components {
interface AtomGrid {
"fixed"?: boolean;
}
interface AtomIcon {
"color"?: Color;
"icon"?: string;
"size"?: 'small' | 'large';
}
interface AtomInput {
"accept"?: string;
"autofocus": boolean;
Expand Down Expand Up @@ -117,6 +121,12 @@ declare global {
prototype: HTMLAtomGridElement;
new (): HTMLAtomGridElement;
};
interface HTMLAtomIconElement extends Components.AtomIcon, HTMLStencilElement {
}
var HTMLAtomIconElement: {
prototype: HTMLAtomIconElement;
new (): HTMLAtomIconElement;
};
interface HTMLAtomInputElement extends Components.AtomInput, HTMLStencilElement {
}
var HTMLAtomInputElement: {
Expand All @@ -139,6 +149,7 @@ declare global {
"atom-button": HTMLAtomButtonElement;
"atom-col": HTMLAtomColElement;
"atom-grid": HTMLAtomGridElement;
"atom-icon": HTMLAtomIconElement;
"atom-input": HTMLAtomInputElement;
"atom-row": HTMLAtomRowElement;
"atom-select": HTMLAtomSelectElement;
Expand Down Expand Up @@ -171,6 +182,11 @@ declare namespace LocalJSX {
interface AtomGrid {
"fixed"?: boolean;
}
interface AtomIcon {
"color"?: Color;
"icon"?: string;
"size"?: 'small' | 'large';
}
interface AtomInput {
"accept"?: string;
"autofocus"?: boolean;
Expand Down Expand Up @@ -234,17 +250,20 @@ declare namespace LocalJSX {
"atom-button": AtomButton;
"atom-col": AtomCol;
"atom-grid": AtomGrid;
"atom-icon": AtomIcon;
"atom-input": AtomInput;
"atom-row": AtomRow;
"atom-select": AtomSelect;
}
}
export { LocalJSX as JSX };
declare module "@stencil/core" {
export namespace JSX {
interface IntrinsicElements {
"atom-button": LocalJSX.AtomButton & JSXBase.HTMLAttributes<HTMLAtomButtonElement>;
"atom-col": LocalJSX.AtomCol & JSXBase.HTMLAttributes<HTMLAtomColElement>;
"atom-grid": LocalJSX.AtomGrid & JSXBase.HTMLAttributes<HTMLAtomGridElement>;
"atom-icon": LocalJSX.AtomIcon & JSXBase.HTMLAttributes<HTMLAtomIconElement>;
"atom-input": LocalJSX.AtomInput & JSXBase.HTMLAttributes<HTMLAtomInputElement>;
"atom-row": LocalJSX.AtomRow & JSXBase.HTMLAttributes<HTMLAtomRowElement>;
"atom-select": LocalJSX.AtomSelect & JSXBase.HTMLAttributes<HTMLAtomSelectElement>;
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/components/icon/icon.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { newSpecPage } from '@stencil/core/testing'

import { AtomIcon, CDN_URL } from './icon'
import { AtomIcon } from './icon'

const URL_MOCK = 'https://unpkg.com/ionicons@7.1.0/dist/ionicons/svg'

describe('atom-icon', () => {
it('should render ion-icon element', async () => {
Expand All @@ -18,7 +20,7 @@ describe('atom-icon', () => {
expect(page.root).toEqualHtml(`
<atom-icon color="primary" icon="heart" size="large">
<mock:shadow-root>
<ion-icon color="primary" icon="${CDN_URL}/heart.svg" size="large"></ion-icon>
<ion-icon color="primary" icon="${URL_MOCK}/heart.svg" size="large"></ion-icon>
</mock:shadow-root>
</atom-icon>
`)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Color } from '@ionic/core'
import { Component, Prop, h } from '@stencil/core'

export const CDN_URL = 'https://unpkg.com/ionicons@7.1.0/dist/ionicons/svg'
const CDN_URL = 'https://unpkg.com/ionicons@7.1.0/dist/ionicons/svg'

@Component({
tag: 'atom-icon',
Expand Down

0 comments on commit 1fdcc3b

Please sign in to comment.