/** * Purpose: assert supports theme.test.js by holding or executing the assert page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const assert = require('assert') /** * Purpose: theme supports theme.test.js by holding or executing the theme page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const theme = require('./theme') assert.strictEqual(theme.DEFAULT_SHOP_THEME.primaryColor, '#E8B4B8') assert.strictEqual(theme.DEFAULT_SHOP_THEME.secondaryColor, '#C5A059') assert.strictEqual(theme.DEFAULT_SHOP_THEME.accentColor, '#4A443F') assert.strictEqual(theme.DEFAULT_SHOP_THEME.pageBgColor, '#FDFBF9') assert.ok(theme.DEFAULT_SHOP_THEME.styleVars.includes('--theme-neutral: #4A443F;')) assert.ok(theme.DEFAULT_SHOP_THEME.styleVars.includes('--theme-tertiary: #FDFBF9;')) /** * Purpose: customized supports theme.test.js by holding or executing the customized page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const customized = theme.resolveShopTheme({ themePrimaryColor: '#8b4f65', themeSecondaryColor: '#f2c9d4', themeAccentColor: '#b86f84', themePageBgColor: '#fff8fa', themeCardBgColor: '#ffffff', themeBackgroundImageFileId: 'bg-file' }) assert.strictEqual(customized.primaryColor, '#8B4F65') assert.strictEqual(customized.secondaryColor, '#F2C9D4') assert.strictEqual(customized.accentColor, '#B86F84') assert.strictEqual(customized.pageBgColor, '#FFF8FA') assert.strictEqual(customized.cardBgColor, '#FFFFFF') assert.strictEqual(customized.backgroundImageFileId, 'bg-file') assert.ok(customized.styleVars.includes('--theme-primary: #8B4F65;')) assert.ok(customized.styleVars.includes('--theme-neutral: #B86F84;')) assert.ok(customized.styleVars.includes('--theme-primary-action: #AB667B;')) assert.ok(customized.styleVars.includes('--theme-gradient: linear-gradient(135deg, #AB667B 0%, #F2C9D4 100%);')) /** * Purpose: themedPageData supports theme.test.js by holding or executing the themed page data page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const themedPageData = theme.pageThemeData(customized, 'https://static.example.test/bg.jpg') assert.ok(themedPageData.themeVars.includes('background-image: url("https://static.example.test/bg.jpg");')) assert.strictEqual(themedPageData.theme.backgroundImageUrl, 'https://static.example.test/bg.jpg') /** * Purpose: fallback supports theme.test.js by holding or executing the fallback page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const fallback = theme.resolveShopTheme({ themePrimaryColor: '#fff', themeSecondaryColor: 'blue' }) assert.strictEqual(fallback.primaryColor, theme.DEFAULT_SHOP_THEME.primaryColor) assert.strictEqual(fallback.secondaryColor, theme.DEFAULT_SHOP_THEME.secondaryColor) assert.ok(fallback.styleVars.includes('--theme-page-bg:'))