Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 31 additions & 25 deletions semcore/button/__tests__/button.browser-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(4).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -119,6 +119,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}
if (item.disabled) {
Expand Down Expand Up @@ -158,15 +159,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(0).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -178,6 +179,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}

Expand All @@ -197,7 +199,7 @@ test.describe(`${TAG.VISUAL} `, () => {
const hint = page.locator('div[data-ui-name="Hint"]');
await locators.button(page).first().waitFor({ state: 'visible' });
await page.waitForTimeout(100);
if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(locators.button(page).first()).toBeFocused();
Expand All @@ -212,7 +214,7 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await locators.button(page).nth(1).hover();
await page.getByText('Hint Button Addon').waitFor({ state: 'visible' });
Expand All @@ -226,8 +228,8 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.disabled) {
await test.step(`Verify disabled styles`, async () => {
if (item.disabled || item.loading) {
await test.step(`Verify disabled / loading styles`, async () => {
await expect(page).toHaveScreenshot();
});
}
Expand Down Expand Up @@ -285,15 +287,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(4).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -305,6 +307,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}

Expand Down Expand Up @@ -345,15 +348,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(0).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -365,6 +368,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}

Expand All @@ -385,7 +389,7 @@ test.describe(`${TAG.VISUAL} `, () => {
await locators.button(page).first().waitFor({ state: 'visible' });
await page.waitForTimeout(100);

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(locators.button(page).first()).toBeFocused();
Expand All @@ -400,7 +404,7 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await locators.button(page).nth(1).hover();
await page.getByText('Hint Button Addon').waitFor({ state: 'visible' });
Expand All @@ -414,8 +418,8 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.disabled) {
await test.step(`Verify disabled styles`, async () => {
if (item.disabled || item.loading) {
await test.step(`Verify disabled / loading styles`, async () => {
await expect(page).toHaveScreenshot();
});
}
Expand Down Expand Up @@ -454,7 +458,7 @@ test.describe(`${TAG.VISUAL} `, () => {
await page.keyboard.press('Tab');
const count = await locators.button(page).count();

if (!item.loading) {
if (!item.loading && !item.loading) {
await test.step('Verify text paddings and spacing based on content', async () => {
for (let i = 0; i < count; i++) {
const button = locators.button(page).nth(i);
Expand All @@ -473,15 +477,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(4).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -493,6 +497,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}

Expand Down Expand Up @@ -533,15 +538,15 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await locators.button(page).nth(0).hover();
await expect(page).toHaveScreenshot();
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(page).toHaveScreenshot();
Expand All @@ -553,6 +558,7 @@ test.describe(`${TAG.VISUAL} `, () => {
for (let i = 0; i < count; i++) {
await expect(locators.button(page).nth(i)).toHaveAttribute('aria-busy', 'true');
}
await expect(page).toHaveScreenshot();
});
}

Expand All @@ -573,7 +579,7 @@ test.describe(`${TAG.VISUAL} `, () => {
await locators.button(page).first().waitFor({ state: 'visible' });
await page.waitForTimeout(100);

if (!item.active && !item.disabled) {
if (!item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for not active button styles`, async () => {
await page.keyboard.press('Tab');
await expect(locators.button(page).first()).toBeFocused();
Expand All @@ -588,7 +594,7 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.active && !item.disabled) {
if (item.active && !item.disabled && !item.loading) {
await test.step(`Verify focus styles for active button styles`, async () => {
await locators.button(page).nth(1).hover();
await page.getByText('Hint Button Addon').waitFor({ state: 'visible' });
Expand All @@ -602,8 +608,8 @@ test.describe(`${TAG.VISUAL} `, () => {
});
}

if (item.disabled) {
await test.step(`Verify disabled styles`, async () => {
if (item.disabled || item.loading) {
await test.step(`Verify disabled / loading styles`, async () => {
await expect(page).toHaveScreenshot();
});
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion semcore/button/src/component/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class RootButton extends Component<
type='button'
tag='button'
tabIndex={0}
disabled={disabled}
use:disabled={disabled || loading}
use:theme={useTheme}
ref={this.containerRef}
aria-busy={loading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test.describe(`${TAG.VISUAL} `, () => {
const button = locators.buttons(page);
await expect(page).toHaveScreenshot();

if (!item.disabled) {
if (!item.disabled && !item.loading) {
await test.step('Verify focus style for buttons', async () => {
await page.keyboard.press('Tab');

Expand Down
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
1 change: 0 additions & 1 deletion tools/builder/src/unplugin-semcore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const unpluginSemcoreResolve = createUnplugin<{ rootPath: string }>((opts
return id.includes('/semcore/');
},
async load(id) {
console.log('load', id);
const { code } = await loadSemcoreSources(id);

return {
Expand Down
Loading