Skip to content

Commit 1578b1f

Browse files
committed
fixed formatting
1 parent 27a1672 commit 1578b1f

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

.eslintrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
"plugin:react-hooks/recommended",
88
"plugin:prettier/recommended"
99
],
10-
"ignorePatterns": ["dist", ".eslintrc.cjs", "example", "node_modules", "playwright.config.ts", "tests"],
10+
"ignorePatterns": [
11+
"dist",
12+
".eslintrc.cjs",
13+
"example",
14+
"node_modules",
15+
"playwright.config.ts",
16+
"tests"
17+
],
1118
"parser": "@typescript-eslint/parser",
1219
"parserOptions": {
1320
"ecmaVersion": "latest",

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export default defineConfig({
2626
port: 3000,
2727
reuseExistingServer: !process.env.CI,
2828
},
29-
});
29+
});

tests/widget-embed.spec.ts

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ declare global {
77
}
88

99
test.describe('VapiWidget Embed Tests', () => {
10-
test('should load widget from script tag with data attributes', async ({ page }) => {
10+
test('should load widget from script tag with data attributes', async ({
11+
page,
12+
}) => {
1113
// Navigate to the test page
1214
await page.goto('/test-widget-embed.html');
1315

1416
// Wait for the widget script to load
15-
await page.waitForFunction(() => (window as any).WidgetLoader !== undefined, { timeout: 5000 });
17+
await page.waitForFunction(
18+
() => (window as any).WidgetLoader !== undefined,
19+
{ timeout: 5000 }
20+
);
1621

1722
// Check if widget container exists
1823
const widget1 = await page.locator('#vapi-widget-1');
@@ -33,16 +38,25 @@ test.describe('VapiWidget Embed Tests', () => {
3338
const widget = document.querySelector('#vapi-widget-1');
3439
if (!widget) return false;
3540
// Check for React root or any child elements
36-
return widget.children.length > 0 || widget.shadowRoot !== null || widget.innerHTML !== '';
41+
return (
42+
widget.children.length > 0 ||
43+
widget.shadowRoot !== null ||
44+
widget.innerHTML !== ''
45+
);
3746
});
3847
expect(widgetInitialized).toBe(true);
3948
});
4049

41-
test('should load widget from script tag with data-props JSON', async ({ page }) => {
50+
test('should load widget from script tag with data-props JSON', async ({
51+
page,
52+
}) => {
4253
await page.goto('/test-widget-embed.html');
4354

4455
// Wait for the widget script to load
45-
await page.waitForFunction(() => (window as any).WidgetLoader !== undefined, { timeout: 5000 });
56+
await page.waitForFunction(
57+
() => (window as any).WidgetLoader !== undefined,
58+
{ timeout: 5000 }
59+
);
4660

4761
// Check if widget container exists
4862
const widget2 = await page.locator('#vapi-widget-2');
@@ -62,7 +76,11 @@ test.describe('VapiWidget Embed Tests', () => {
6276
const widgetInitialized = await page.evaluate(() => {
6377
const widget = document.querySelector('#vapi-widget-2');
6478
if (!widget) return false;
65-
return widget.children.length > 0 || widget.shadowRoot !== null || widget.innerHTML !== '';
79+
return (
80+
widget.children.length > 0 ||
81+
widget.shadowRoot !== null ||
82+
widget.innerHTML !== ''
83+
);
6684
});
6785
expect(widgetInitialized).toBe(true);
6886
});
@@ -77,12 +95,14 @@ test.describe('VapiWidget Embed Tests', () => {
7795
expect(hasWidgetLoader).toBe(true);
7896
});
7997

80-
test('widget builds successfully and creates necessary files', async ({ page }) => {
98+
test('widget builds successfully and creates necessary files', async ({
99+
page,
100+
}) => {
81101
// Navigate to check if built files are accessible
82102
const styleResponse = await page.goto('/dist/style.css');
83103
expect(styleResponse?.status()).toBe(200);
84-
104+
85105
const scriptResponse = await page.goto('/dist/widget.umd.js');
86106
expect(scriptResponse?.status()).toBe(200);
87107
});
88-
});
108+
});

0 commit comments

Comments
 (0)