forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vite-plugin/testing): add sass/scss transform tests
- Loading branch information
1 parent
73c1992
commit 17a8ef5
Showing
9 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<h4>Sass Transform</h4> | ||
|
||
<div> | ||
<ColorOverride /> | ||
<ColorSassUse /> | ||
<ColorScssUse /> | ||
<PaddingTest /> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import ColorOverride from './sass-transform/ColorOverride.vue' | ||
import ColorSassUse from './sass-transform/ColorSassUse.vue' | ||
import ColorScssUse from './sass-transform/ColorScssUse.vue' | ||
import PaddingTest from './sass-transform/PaddingTest.vue' | ||
</script> |
8 changes: 8 additions & 0 deletions
8
vite-plugin/playground/src/components/sass-transform/ColorOverride.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<h6>Color Override</h6> | ||
|
||
<div> | ||
<q-icon name="map" color="primary" size="50px" /> | ||
<q-btn icon="map" color="secondary" round /> | ||
</div> | ||
</template> |
16 changes: 16 additions & 0 deletions
16
vite-plugin/playground/src/components/sass-transform/ColorSassUse.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<h6>Color Use (Sass)</h6> | ||
|
||
<div class="row justify-center"> | ||
<div class="my-colored-div rounded-borders"> | ||
| ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="sass" scoped> | ||
.my-colored-div | ||
background-color: $primary | ||
width: 50px | ||
height: 50px | ||
</style> |
17 changes: 17 additions & 0 deletions
17
vite-plugin/playground/src/components/sass-transform/ColorScssUse.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<h6>Color Use (Scss)</h6> | ||
|
||
<div class="row justify-center"> | ||
<div class="my-colored-div rounded-borders"> | ||
| ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.my-colored-div { | ||
background-color: $primary; | ||
width: 50px; | ||
height: 50px; | ||
} | ||
</style> |
15 changes: 15 additions & 0 deletions
15
vite-plugin/playground/src/components/sass-transform/PaddingTest.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<h6>Padding with $toolbar-padding</h6> | ||
|
||
<div class="row justify-center"> | ||
<div class="my-div"> | ||
| ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="sass" scoped> | ||
.my-div | ||
padding: $toolbar-padding | ||
background-color: $secondary | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { mount } from '@vue/test-utils' | ||
|
||
import 'quasar/src/css/index.sass' | ||
|
||
import { QToolbar } from 'quasar' | ||
import PaddingTest from 'playground/sass-transform/PaddingTest.vue' | ||
|
||
describe('Sass Transform', () => { | ||
test('variables file is taken into account', () => { | ||
const wrapper = mount(QToolbar) | ||
|
||
const { element } = wrapper.get('div') | ||
expect( | ||
window.getComputedStyle(element) | ||
.getPropertyValue('padding') | ||
).toBe('100px') | ||
}) | ||
|
||
test('correctly uses sass variables', () => { | ||
const wrapper = mount(PaddingTest) | ||
|
||
const { element } = wrapper.get('div.my-div') | ||
expect( | ||
window.getComputedStyle(element) | ||
.getPropertyValue('padding') | ||
).toBe('100px') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters