Skip to content

Commit

Permalink
chore: Add Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashubham committed Jun 26, 2020
1 parent a057043 commit 9760bae
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion playground/css/TestCssModules.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
<div class="css-modules-import" :class="imported.turquoise">
CSS modules import - this should be orange
</div>
<div class="scss-modules-import" :class="importedScss.magenta">
SCSS modules import - this should be magenta
</div>
</template>

<script>
import imported from './testCssModules.module.css'
import importedScss from './testScssModules.module.scss';
export default {
data: () => ({ imported })
data: () => ({ imported, importedScss })
}
</script>

Expand Down
4 changes: 4 additions & 0 deletions playground/css/testScssModules.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.magenta {
color: rgb(255, 0, 255);
}

15 changes: 15 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,21 @@ describe('vite', () => {
}
})

test('import *.module.scss', async () => {
const el = await page.$('.scss-modules-import')
expect(await getComputedColor(el)).toBe('rgb(255, 0, 255)')
if (!isBuild) {
await updateFile('css/testScssModules.module.scss', (content) =>
content.replace('rgb(255, 0, 255)', 'rgb(0, 0, 2)')
)
// css module results in component reload so must use fresh selector
await expectByPolling(
() => getComputedColor('.scss-modules-import'),
'rgb(0, 0, 2)'
)
}
})

test('pre-processors', async () => {
expect(await getText('.pug')).toMatch('template lang="pug"')
expect(await getComputedColor('.pug')).toBe('rgb(255, 0, 255)')
Expand Down

0 comments on commit 9760bae

Please sign in to comment.