Skip to content

Commit b73b133

Browse files
wip(tests): test Vue3 cssVars
1 parent a4886ed commit b73b133

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/basic.test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,46 @@ const { defaultFilesFactory, createPage } = require('./testsTools.js');
822822
});
823823

824824

825+
if ( vueTarget === 3 ) { // Vue 2 does not handle cssVars
826+
827+
test.only('should handle cssVars', async () => {
828+
829+
const { page, output } = await createPage({
830+
files: {
831+
...files,
832+
833+
'/component.vue': `
834+
835+
<template>
836+
Hello <span class="example">{{ msg }}</span>
837+
</template>
838+
<script>
839+
export default {
840+
data () {
841+
return {
842+
msg: 'World !',
843+
color: 'blue',
844+
}
845+
}
846+
}
847+
</script>
848+
<style scoped>
849+
.example {
850+
color: v-bind('color')
851+
}
852+
</style>
853+
854+
`
855+
}
856+
});
857+
858+
await expect(page.$eval('#app', el => el.textContent.trim())).resolves.toBe('Hello World !');
859+
await expect(page.$eval('#app .example', el => JSON.parse(JSON.stringify(getComputedStyle(el))))).resolves.toMatchObject( { color: 'rgb(0, 0, 255)' } );
860+
861+
});
862+
}
863+
864+
825865
});
826866

827867

0 commit comments

Comments
 (0)