From bd773a6adc49a111a721084dcff1ec7153ad0e5e Mon Sep 17 00:00:00 2001 From: Aliullov Vlad Date: Thu, 17 Oct 2024 17:50:53 +0400 Subject: [PATCH] fix tests after remove bootstrap versions < 5 --- .../src/modules/bootstrap-extractor.ts | 9 ++++++--- .../tests/modules/bootstrap-extractor.test.ts | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts index ad6cb0cedca5..4228d476366c 100644 --- a/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts +++ b/packages/devextreme-themebuilder/src/modules/bootstrap-extractor.ts @@ -79,9 +79,12 @@ export default class BootstrapExtractor { const variables = await this.readSassFile('_variables.scss'); const variablesDarkFile = '_variables-dark.scss'; - const variablesDark = this.version === 5 && existsSync(this.getFilePath(variablesDarkFile)) - ? await this.readSassFile(variablesDarkFile) - : ''; // TODO: can be removed safely in bootstrap@6 + + let variablesDark = ''; + + if(existsSync(this.getFilePath(variablesDarkFile))) { + variablesDark = await this.readSassFile(variablesDarkFile) + } const result = `${functions} ${variables.replace('@import "variables-dark";', '')} diff --git a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts index b647e78670a6..e2fceaa7facc 100644 --- a/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts +++ b/packages/devextreme-themebuilder/tests/modules/bootstrap-extractor.test.ts @@ -98,19 +98,21 @@ ${collectorServiceCode}`); }); test('extract (bootstrap 5)', async () => { - const input = '$var1: test1;$var2: test2 !default;$custom-var: test3;$var4: var(--bs-blue);'; + const input = '$var1: test1;$var2: test2 !default;$custom-var: test3;$var4: var(--bs-blue);$var5: -.25rem;'; const extractor = new BootstrapExtractor(input, 5); extractor.meta = { 'dx-var1': '$var1', 'dx-var2': '$var2', 'dx-var3': '$var3', 'dx-var4': '$var4', + 'dx-var5': '$var5', }; expect(await extractor.extract()).toEqual([ { key: '$dx-var1', value: 'test1' }, { key: '$dx-var2', value: 'test2' }, { key: '$dx-var4', value: '#0d6efd' }, + { key: '$dx-var5', value: '-4px' }, ]); }); });