Skip to content

Commit

Permalink
chore(linting): allow e2ePage variable naming (#7236)
Browse files Browse the repository at this point in the history
**Related Issue:** N/A

## Summary

Prevents `unicorn/avoid-abbreviations` from flagging `e2ePage`.
  • Loading branch information
jcfranco authored and benelan committed Jun 28, 2023
1 parent 005836d commit ec375a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions packages/calcite-components/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
"unicorn/prevent-abbreviations": [
"error",
{
"allowList": {
"e2ePage": true
},
"extendDefaultReplacements": false,
"replacements": {
"e": {
Expand Down
18 changes: 9 additions & 9 deletions packages/calcite-components/src/tests/commonTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1251,12 +1251,12 @@ export function floatingUIOwner(

export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void> {
let component: E2EElement;
let E2Epage: E2EPage;
let page: E2EPage;
let getCurrentMessages: () => Promise<MessageBundle>;

beforeEach(async () => {
const { page, tag } = await getTagAndPage(componentTestSetup);
E2Epage = page;
const { page: e2ePage, tag } = await getTagAndPage(componentTestSetup);
page = e2ePage;
component = await page.find(tag);
getCurrentMessages = async (): Promise<MessageBundle> => {
return page.$eval(tag, (component: HTMLElement & { messages: MessageBundle }) => component.messages);
Expand All @@ -1277,7 +1277,7 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>
const messageOverride = { [firstMessageProp]: "override test" };

component.setProperty("messageOverrides", messageOverride);
await E2Epage.waitForChanges();
await page.waitForChanges();

expect(await getCurrentMessages()).toEqual({
...messages,
Expand All @@ -1286,13 +1286,13 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>

// reset test changes
component.setProperty("messageOverrides", undefined);
await E2Epage.waitForChanges();
await page.waitForChanges();
}

async function assertLangSwitch(): Promise<void> {
const enMessages = await getCurrentMessages();
const fakeBundleIdentifier = "__fake__";
await E2Epage.evaluate(
await page.evaluate(
(enMessages, fakeBundleIdentifier) => {
const orig = window.fetch;
window.fetch = async function (input, init) {
Expand All @@ -1314,14 +1314,14 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>
);

component.setAttribute("lang", "es");
await E2Epage.waitForChanges();
await E2Epage.waitForTimeout(3000);
await page.waitForChanges();
await page.waitForTimeout(3000);
const esMessages = await getCurrentMessages();

expect(esMessages).toHaveProperty(fakeBundleIdentifier);

// reset test changes
component.removeAttribute("lang");
await E2Epage.waitForChanges();
await page.waitForChanges();
}
}

0 comments on commit ec375a3

Please sign in to comment.