Skip to content

Commit 820bf0c

Browse files
committed
chore: scripts
1 parent b284437 commit 820bf0c

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

core/scripts/testing/scripts.js

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,25 @@
6060
let defaultTokens;
6161
let theme;
6262

63-
// Get the base URL from the current location (similar to how set-content.ts works)
63+
// Get the base URL from the current location
6464
const baseUrl = window.location.origin;
6565

66-
console.info(`Attempting to load theme tokens for ${themeName} with palette ${paletteName}`);
67-
console.info(`Base URL: ${baseUrl}`);
68-
console.info(`Current location: ${window.location.href}`);
69-
70-
// First try the base URL path (matches how set-content.ts imports Ionic)
66+
// First try the base URL path
7167
try {
72-
const importPath = `${baseUrl}/dist/themes/${themeName}/default.tokens.js`;
73-
console.info(`Trying import path: ${importPath}`);
74-
defaultTokens = await import(importPath);
68+
defaultTokens = await import(`${baseUrl}/dist/themes/${themeName}/default.tokens.js`);
7569
theme = defaultTokens.defaultTheme;
7670
} catch (baseUrlError) {
77-
console.warn(`Failed to load from ${baseUrl}/dist/themes/${themeName}/default.tokens.js, trying relative paths:`, baseUrlError);
78-
79-
// Try the relative dist path (matches how test files import Ionic)
71+
// Try relative dist path
8072
try {
8173
defaultTokens = await import(`../../../../../dist/themes/${themeName}/default.tokens.js`);
8274
theme = defaultTokens.defaultTheme;
8375
} catch (relativeDistError) {
84-
console.warn(`Failed to load from ../../../../../dist/themes/${themeName}/default.tokens.js, trying absolute paths:`, relativeDistError);
85-
8676
// Try absolute dist path
8777
try {
8878
defaultTokens = await import(`/dist/themes/${themeName}/default.tokens.js`);
8979
theme = defaultTokens.defaultTheme;
9080
} catch (absoluteDistError) {
91-
console.warn(`Failed to load from /dist/themes/${themeName}/default.tokens.js, trying simple relative path:`, absoluteDistError);
81+
// All import attempts failed
9282
}
9383
}
9484
}
@@ -109,30 +99,22 @@
10999
const themeUtilsPaths = [
110100
`${baseUrl}/dist/themes/utils/theme.js`,
111101
'../../../../../dist/themes/utils/theme.js',
112-
'/dist/themes/utils/theme.js',
113-
'./themes/utils/theme.js'
102+
'/dist/themes/utils/theme.js'
114103
];
115104

116-
let themeUtilsLoaded = false;
117105
for (const path of themeUtilsPaths) {
118106
try {
119107
const themeModule = await import(path);
120108
themeModule.applyGlobalTheme(theme);
121-
themeUtilsLoaded = true;
122109
break;
123110
} catch (error) {
124111
// Continue to next path
125112
}
126113
}
127-
128-
if (!themeUtilsLoaded) {
129-
console.warn('Could not reapply theme - theme module not found in any path');
130-
}
131114
}
132-
133-
console.info(`Loaded ${themeName} theme with palette ${paletteName}:`, theme);
134115
} catch (error) {
135116
console.warn(`Failed to load theme tokens for ${themeName}:`, error);
117+
throw new Error(`Could not load theme tokens for ${themeName} from any path`);
136118
}
137119
}
138120

core/src/components/modal/test/card-refresher/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link href="../../../../../../css/ionic.bundle.css" rel="stylesheet" />
1313
<link href="../../../../../../scripts/testing/styles.css" rel="stylesheet" />
1414
<script src="../../../../../../scripts/testing/scripts.js"></script>
15-
<script type="module" src="../../../../../../dist/ionic/ionic.esm.js"></script>
15+
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
1616

1717
<style>
1818
#content {

core/src/components/modal/test/card-scroll-target/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link href="../../../../../../css/ionic.bundle.css" rel="stylesheet" />
1313
<link href="../../../../../../scripts/testing/styles.css" rel="stylesheet" />
1414
<script src="../../../../../../scripts/testing/scripts.js"></script>
15-
<script type="module" src="../../../../../../dist/ionic/ionic.esm.js"></script>
15+
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
1616
<style>
1717
#content {
1818
position: relative;

0 commit comments

Comments
 (0)