Skip to content

Commit

Permalink
test: migrate all defineElement tests into base
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterloftis committed May 2, 2023
1 parent f5d7dd6 commit dd3522e
Show file tree
Hide file tree
Showing 66 changed files with 163 additions and 519 deletions.
9 changes: 1 addition & 8 deletions packages/asset/test/asset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ governing permissions and limitations under the License.
import { elementUpdated, expect, fixture } from '@open-wc/testing';

import { Asset } from '@spectrum-web-components/asset';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers';
import { testForLitDevWarnings } from '../../../test/testing-helpers';
import { Default, File, Folder } from '../stories/asset.stories.js';

describe('Asset', () => {
Expand All @@ -42,8 +39,4 @@ describe('Asset', () => {

await expect(el).to.be.accessible();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-asset.js'))
);
});
9 changes: 1 addition & 8 deletions packages/avatar/test/avatar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ governing permissions and limitations under the License.
import '@spectrum-web-components/avatar/sp-avatar.js';
import { Avatar } from '@spectrum-web-components/avatar';
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers';
import { testForLitDevWarnings } from '../../../test/testing-helpers';

describe('Avatar', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -114,8 +111,4 @@ describe('Avatar', () => {
}).to.throw('There should be no error.');
}
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-avatar.js'))
);
});
9 changes: 1 addition & 8 deletions packages/badge/test/badge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import '@spectrum-web-components/badge/sp-badge.js';
import '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';
import { stub } from 'sinon';
import { Badge } from '../src/Badge.js';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('Badge', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -152,8 +149,4 @@ describe('Badge', () => {
});
});
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-badge.js'))
);
});
5 changes: 0 additions & 5 deletions packages/banner/test/banner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ governing permissions and limitations under the License.
import '@spectrum-web-components/banner/sp-banner.js';
import { Banner } from '@spectrum-web-components/banner';
import { expect, fixture, html } from '@open-wc/testing';
import { warnsOnDoubleRegister } from '../../../test/testing-helpers.js';

describe('banner', () => {
let testDiv!: HTMLDivElement;
Expand Down Expand Up @@ -93,8 +92,4 @@ describe('banner', () => {
expect(el.textContent).to.include('Header Text');
expect(el.textContent).to.include('Content');
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-banner.js'))
);
});
9 changes: 1 addition & 8 deletions packages/button-group/test/button-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ import { elementUpdated, expect, fixture } from '@open-wc/testing';
import '@spectrum-web-components/button-group/sp-button-group.js';
import { ButtonGroup } from '..';
import { buttons, buttonsVertical } from '../stories/button-group.stories.js';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('Buttongroup', () => {
testForLitDevWarnings(
Expand All @@ -40,8 +37,4 @@ describe('Buttongroup', () => {

await expect(el).to.be.accessible();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-button-group.js'))
);
});
5 changes: 0 additions & 5 deletions packages/button/test/button.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
import {
shiftTabEvent,
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { spy } from 'sinon';

Expand Down Expand Up @@ -563,8 +562,4 @@ describe('Button', () => {
expect(el.variant).to.equal('accent');
});
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-button.js'))
);
});
9 changes: 1 addition & 8 deletions packages/card/test/card.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ import {
} from '../stories/card.stories.js';
import { Checkbox } from '@spectrum-web-components/checkbox/src/Checkbox';
import { spy } from 'sinon';
import {
spaceEvent,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { spaceEvent } from '../../../test/testing-helpers.js';
import { sendMouse } from '../../../test/plugins/browser.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

Expand Down Expand Up @@ -440,8 +437,4 @@ describe('card', () => {
'the slotted content renders in the element'
);
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-card.js'))
);
});
9 changes: 1 addition & 8 deletions packages/checkbox/test/checkbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
waitUntil,
} from '@open-wc/testing';
import '@spectrum-web-components/shared/src/focus-visible.js';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

function inputForCheckbox(checkbox: Checkbox): HTMLInputElement {
if (!checkbox.shadowRoot) throw new Error('No shadowRoot');
Expand Down Expand Up @@ -207,8 +204,4 @@ describe('Checkbox', () => {

expect(el.checked).to.be.true;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-checkbox.js'))
);
});
9 changes: 1 addition & 8 deletions packages/coachmark/test/coachmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

import '@spectrum-web-components/coachmark/sp-coachmark.js';
import { Coachmark } from '@spectrum-web-components/coachmark';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('Coachmark', () => {
testForLitDevWarnings(
Expand All @@ -39,8 +36,4 @@ describe('Coachmark', () => {

await expect(el).to.be.accessible();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-coachmark.js'))
);
});
9 changes: 1 addition & 8 deletions packages/color-area/test/color-area.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ import { ColorArea } from '@spectrum-web-components/color-area';
import { sendKeys } from '@web/test-runner-commands';
import { spy } from 'sinon';
import { ColorHandle } from '@spectrum-web-components/color-handle';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('ColorArea', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -776,8 +773,4 @@ describe('ColorArea', () => {
el.color = '#f3af';
expect(el.color).to.equal('#ff33aaff');
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-color-area.js'))
);
});
9 changes: 1 addition & 8 deletions packages/color-handle/test/color-handle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

import '@spectrum-web-components/color-handle/sp-color-handle.js';
import { ColorHandle } from '@spectrum-web-components/color-handle';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('ColorHandle', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -109,8 +106,4 @@ describe('ColorHandle', () => {

expect(el.open).to.be.false;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-color-handle.js'))
);
});
9 changes: 1 addition & 8 deletions packages/color-loupe/test/color-loupe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

import '@spectrum-web-components/color-loupe/sp-color-loupe.js';
import { ColorLoupe } from '@spectrum-web-components/color-loupe';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('ColorLoupe', () => {
testForLitDevWarnings(
Expand All @@ -39,8 +36,4 @@ describe('ColorLoupe', () => {

await expect(el).to.be.accessible();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-color-loupe.js'))
);
});
5 changes: 0 additions & 5 deletions packages/color-slider/test/color-slider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
arrowUpEvent,
arrowUpKeyupEvent,
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';

import '@spectrum-web-components/color-slider/sp-color-slider.js';
Expand Down Expand Up @@ -788,8 +787,4 @@ describe('ColorSlider', () => {
expect(el.value).to.equal(hue);
expect(tinyHSLA.equals(el.color)).to.be.true;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-color-slider.js'))
);
});
5 changes: 0 additions & 5 deletions packages/color-wheel/test/color-wheel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
arrowUpKeyupEvent,
ignoreResizeObserverLoopError,
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';

import '@spectrum-web-components/color-wheel/sp-color-wheel.js';
Expand Down Expand Up @@ -617,8 +616,4 @@ describe('ColorWheel', () => {
expect(el.value).to.equal(hue);
expect(tinyHSLA.equals(el.color)).to.be.true;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-color-wheel.js'))
);
});
5 changes: 0 additions & 5 deletions packages/dialog/test/dialog-base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import '@spectrum-web-components/overlay/overlay-trigger.js';
import { alertDestructive } from '../stories/dialog.stories.js';
import { Button } from '@spectrum-web-components/button/src/Button.js';
import { DialogBase } from '@spectrum-web-components/dialog';
import { warnsOnDoubleRegister } from '../../../test/testing-helpers.js';

async function styledFixture<T extends Element>(
story: TemplateResult
Expand Down Expand Up @@ -152,8 +151,4 @@ describe('dialog base', () => {

expect(dialog.open).to.be.false;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-dialog-base.js'))
);
});
9 changes: 1 addition & 8 deletions packages/dialog/test/dialog-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ import {
import { OverlayTrigger } from '@spectrum-web-components/overlay';
import { html, TemplateResult } from '@spectrum-web-components/base';
import { Theme } from '@spectrum-web-components/theme';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';
import { Divider } from '@spectrum-web-components/divider/src/Divider.js';

async function styledFixture<T extends Element>(
Expand Down Expand Up @@ -341,8 +338,4 @@ describe('Dialog Wrapper', () => {
});
consoleWarnStub.restore();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-dialog-wrapper.js'))
);
});
9 changes: 1 addition & 8 deletions packages/dialog/test/dialog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ import {
small,
} from '../stories/dialog.stories.js';
import { spy } from 'sinon';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('Dialog', () => {
testForLitDevWarnings(async () => await fixture<Dialog>(small()));
Expand Down Expand Up @@ -241,8 +238,4 @@ describe('Dialog', () => {
const container = el.shadowRoot.querySelector('#dismiss-container');
expect(container).to.not.be.null;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-dialog.js'))
);
});
9 changes: 1 addition & 8 deletions packages/divider/test/divider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

import '@spectrum-web-components/divider/sp-divider.js';
import { Divider } from '@spectrum-web-components/divider';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('Divider', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -50,8 +47,4 @@ describe('Divider', () => {

await expect(el).to.be.accessible();
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-divider.js'))
);
});
9 changes: 1 addition & 8 deletions packages/dropzone/test/dropzone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ governing permissions and limitations under the License.
import '@spectrum-web-components/dropzone/sp-dropzone.js';
import { Dropzone } from '@spectrum-web-components/dropzone';
import { illustration } from './test-svg.js';
import {
waitForPredicate,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { waitForPredicate } from '../../../test/testing-helpers.js';
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';

describe('Dropzone', () => {
Expand Down Expand Up @@ -190,8 +187,4 @@ describe('Dropzone', () => {

expect(dropped).to.be.true;
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-dropzone.js'))
);
});
9 changes: 1 addition & 8 deletions packages/field-group/test/field-group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import { FieldGroup } from '@spectrum-web-components/field-group';
import '@spectrum-web-components/help-text/sp-help-text.js';
import '@spectrum-web-components/checkbox/sp-checkbox.js';
import '@spectrum-web-components/field-group/sp-field-group.js';
import {
testForLitDevWarnings,
warnsOnDoubleRegister,
} from '../../../test/testing-helpers.js';
import { testForLitDevWarnings } from '../../../test/testing-helpers.js';

describe('FieldGroup', () => {
testForLitDevWarnings(
Expand Down Expand Up @@ -134,8 +131,4 @@ describe('FieldGroup', () => {
await findDescribedNode(name, descriptionNegative);
});
});
describe(
'dev mode registration',
warnsOnDoubleRegister(() => import('../sp-field-group.js'))
);
});
Loading

0 comments on commit dd3522e

Please sign in to comment.