Skip to content

Commit

Permalink
chore(web-components): remove web types (#32308)
Browse files Browse the repository at this point in the history
  • Loading branch information
radium-v authored Aug 15, 2024
1 parent 2eac169 commit 8492a7e
Show file tree
Hide file tree
Showing 45 changed files with 298 additions and 282 deletions.
3 changes: 0 additions & 3 deletions apps/vr-tests-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"type-check": "tsc -p . --baseUrl . --noEmit",
"test-vr": "storywright --browsers chromium --url dist/storybook --destpath dist/screenshots --waitTimeScreenshot 500 --concurrency 4 --headless true"
},
"devDependencies": {
"@types/web": "^0.0.142"
},
"dependencies": {
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/vr-tests-web-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"resolveJsonModule": true,
"allowJs": true,
"jsx": "react",
"types": ["jest", "node", "web"]
"types": ["jest", "node"]
},
"include": ["./src", "./.storybook/*"],
"files": ["./typings/html-react-parser/index.d.ts"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "remove web types package and configuration",
"packageName": "@fluentui/web-components",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion packages/web-components/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"allowJs": true,
"checkJs": true,
"noEmit": true,
"types": ["node", "web"]
"types": ["node"]
},
"include": ["*", "../public", "../src/**/*.stories.*"]
}
38 changes: 30 additions & 8 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

```ts

/// <reference types="web" />

import { CaptureType } from '@microsoft/fast-element';
import { CSSDirective } from '@microsoft/fast-element';
import { Direction } from '@microsoft/fast-web-utilities';
Expand Down Expand Up @@ -118,7 +116,6 @@ export const accordionStyles: ElementStyles;
export const accordionTemplate: ElementViewTemplate<Accordion>;

// Warning: (ae-different-release-tags) This symbol has another declaration with a different release tag
// Warning: (ae-forgotten-export) The symbol "BaseAnchor" needs to be exported by the entry point index.d.ts
// Warning: (ae-internal-mixed-release-tag) Mixed release tags are not allowed for "AnchorButton" because one of its declarations is marked as @internal
//
// @public
Expand Down Expand Up @@ -451,6 +448,30 @@ export class BaseAccordionItem extends FASTElement {
id: string;
}

// @public
export class BaseAnchor extends FASTElement {
constructor();
// @internal
clickHandler(e: PointerEvent): boolean;
// (undocumented)
connectedCallback(): void;
// (undocumented)
disconnectedCallback(): void;
download?: string;
// @internal
elementInternals: ElementInternals;
// @internal
handleChange(source: any, propertyName: string): void;
href?: string;
hreflang?: string;
keydownHandler(e: KeyboardEvent): boolean | void;
ping?: string;
referrerpolicy?: string;
rel: string;
target?: AnchorTarget;
type?: string;
}

// @public
export class BaseAvatar extends FASTElement {
constructor();
Expand Down Expand Up @@ -2646,7 +2667,7 @@ export class Menu extends FASTElement {
setComponent(): void;
slottedMenuList: MenuList[];
slottedTriggers: HTMLElement[];
toggleHandler: (e: Event | ToggleEvent) => void;
toggleHandler: (e: Event) => void;
toggleMenu: () => void;
triggerKeydownHandler: (e: KeyboardEvent) => boolean | void;
}
Expand Down Expand Up @@ -2728,7 +2749,7 @@ export class MenuItem extends FASTElement {
// @internal (undocumented)
submenu: HTMLElement | undefined;
// @internal
toggleHandler: (e: ToggleEvent | Event) => void;
toggleHandler: (e: Event) => void;
}

// @internal
Expand Down Expand Up @@ -2815,15 +2836,16 @@ export const MenuStyles: ElementStyles;
export const MenuTemplate: ElementViewTemplate<Menu>;

// @public
export class ProgressBar extends BaseProgressBar {
class ProgressBar_2 extends BaseProgressBar {
shape?: ProgressBarShape;
shapeChanged(prev: ProgressBarShape | undefined, next: ProgressBarShape | undefined): void;
thickness?: ProgressBarThickness;
thicknessChanged(prev: ProgressBarThickness | undefined, next: ProgressBarThickness | undefined): void;
}
export { ProgressBar_2 as ProgressBar }

// @public
export const ProgressBarDefinition: FASTElementDefinition<typeof ProgressBar>;
export const ProgressBarDefinition: FASTElementDefinition<typeof ProgressBar_2>;

// @public
export const ProgressBarShape: {
Expand All @@ -2840,7 +2862,7 @@ export const ProgressBarStyles: ElementStyles;
// Warning: (ae-missing-release-tag) "template" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ProgressBarTemplate: ElementViewTemplate<ProgressBar>;
export const ProgressBarTemplate: ElementViewTemplate<ProgressBar_2>;

// @public
export const ProgressBarThickness: {
Expand Down
1 change: 0 additions & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@
"devDependencies": {
"@microsoft/fast-element": "2.0.0-beta.26",
"@tensile-perf/web-components": "~0.2.0",
"@types/web": "^0.0.142",
"@storybook/html": "7.6.20",
"@storybook/html-webpack5": "7.6.20",
"chromedriver": "^125.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { AccordionItem } from './accordion-item.js';

test.describe('Accordion item', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/accordion/accordion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Locator } from '@playwright/test';
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';

test.describe('Accordion', () => {
test.beforeEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spinalCase } from '@microsoft/fast-web-utilities';
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';

const proxyAttributes = {
href: 'href',
Expand Down
10 changes: 5 additions & 5 deletions packages/web-components/src/avatar/avatar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { Avatar } from './avatar.js';
import { AvatarAppearance, AvatarColor, AvatarSize } from './avatar.options.js';

Expand Down Expand Up @@ -139,7 +139,7 @@ test.describe('Avatar Component', () => {
test('default color should be neutral', async ({ page }) => {
const element = page.locator('fluent-avatar');

expect(await element.evaluate((node: Avatar) => node.elementInternals.states.has('neutral'))).toBe(true);
await expect(element).toHaveCustomState('neutral');
});

test('should add a custom state of `brand` when `brand is provided as the color', async ({ page }) => {
Expand All @@ -149,7 +149,7 @@ test.describe('Avatar Component', () => {
<fluent-avatar color-id="pumpkin" name="John Doe" color="brand"></fluent-avatar>
`);

expect(await element.evaluate((node: Avatar) => node.elementInternals.states.has('brand'))).toBe(true);
await expect(element).toHaveCustomState('brand');
});

test('should prioritize color derivation from colorId over name when set to "colorful"', async ({ page }) => {
Expand All @@ -159,7 +159,7 @@ test.describe('Avatar Component', () => {
<fluent-avatar color-id="pumpkin" name="Steve Smith" color="colorful"></fluent-avatar>
`);

expect(await element.evaluate((node: Avatar) => node.elementInternals.states.has('pumpkin'))).toBe(true);
await expect(element).toHaveCustomState('pumpkin');
});

test(`should set the color attribute on the internal control`, async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/badge/badge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { Badge } from './badge.js';

test.describe('Badge component', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/src/button/button.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';

test.describe('Button', () => {
test.beforeEach(async ({ page }) => {
Expand Down
24 changes: 12 additions & 12 deletions packages/web-components/src/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { Checkbox } from './checkbox.js';

test.describe('Checkbox', () => {
Expand Down Expand Up @@ -50,21 +50,21 @@ test.describe('Checkbox', () => {
node.shape = 'circular';
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('circular'))).toBe(true);
await expect(element).toHaveCustomState('circular');

await element.evaluate((node: Checkbox) => {
node.shape = 'square';
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('circular'))).toBe(false);
expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('square'))).toBe(true);
await expect(element).not.toHaveCustomState('circular');
await expect(element).toHaveCustomState('square');

await element.evaluate((node: Checkbox) => {
node.shape = undefined;
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('circular'))).toBe(false);
expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('square'))).toBe(false);
await expect(element).not.toHaveCustomState('circular');
await expect(element).not.toHaveCustomState('square');
});

test('should set and retrieve the `size` property correctly', async ({ page }) => {
Expand Down Expand Up @@ -110,21 +110,21 @@ test.describe('Checkbox', () => {
node.size = 'medium';
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('medium'))).toBe(true);
await expect(element).toHaveCustomState('medium');

await element.evaluate((node: Checkbox) => {
node.size = 'large';
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('medium'))).toBe(false);
expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('large'))).toBe(true);
await expect(element).not.toHaveCustomState('medium');
await expect(element).toHaveCustomState('large');

await element.evaluate((node: Checkbox) => {
node.size = undefined;
});

expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('medium'))).toBe(false);
expect(await element.evaluate((node: Checkbox) => node.elementInternals.states.has('large'))).toBe(false);
await expect(element).not.toHaveCustomState('medium');
await expect(element).not.toHaveCustomState('large');
});

test('should have a role of `checkbox`', async ({ page }) => {
Expand Down
14 changes: 6 additions & 8 deletions packages/web-components/src/counter-badge/counter-badge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { CounterBadge } from './counter-badge.js';
import {
CounterBadgeAppearance,
Expand Down Expand Up @@ -188,7 +188,7 @@ test.describe('CounterBadge component', () => {

await expect(element).toHaveJSProperty('shape', shape);

expect(await element.evaluate((node, shape) => node.matches(`:state(${shape})`), shape)).toEqual(true);
await expect(element).toHaveCustomState(shape);
});
}

Expand All @@ -206,7 +206,7 @@ test.describe('CounterBadge component', () => {

await expect(element).toHaveJSProperty('color', color);

expect(await element.evaluate((node, color) => node.matches(`:state(${color})`), color)).toEqual(true);
await expect(element).toHaveCustomState(color);
});
}

Expand All @@ -222,7 +222,7 @@ test.describe('CounterBadge component', () => {

await expect(element).toHaveJSProperty('size', size);

expect(await element.evaluate((node, size) => node.matches(`:state(${size})`), size)).toEqual(true);
await expect(element).toHaveCustomState(size);
});
}

Expand All @@ -244,9 +244,7 @@ test.describe('CounterBadge component', () => {

await expect(element).toHaveJSProperty('appearance', appearance);

expect(await element.evaluate((node, appearance) => node.matches(`:state(${appearance})`), appearance)).toEqual(
true,
);
await expect(element).toHaveCustomState(appearance);
});
}
});
4 changes: 2 additions & 2 deletions packages/web-components/src/dialog-body/dialog-body.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { fixtureURL } from '../helpers.tests.js';
import { test } from '@playwright/test';
import { expect, fixtureURL } from '../helpers.tests.js';
import type { Dialog } from '../dialog/dialog.js';
import type { DialogBody } from './dialog-body.js';

Expand Down
Loading

0 comments on commit 8492a7e

Please sign in to comment.