Skip to content

Commit a957846

Browse files
authored
add SASS example (#69)
1 parent a5eb649 commit a957846

File tree

5 files changed

+953
-176
lines changed

5 files changed

+953
-176
lines changed

cypress/components/scss/App.svelte

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script>
2+
export let name;
3+
</script>
4+
5+
<style type="text/scss">
6+
$color: red;
7+
8+
h1 {
9+
color: $color;
10+
}
11+
12+
div {
13+
background: green;
14+
15+
> p {
16+
color: #fff;
17+
}
18+
}
19+
</style>
20+
21+
<h1>Hello {name}!</h1>
22+
23+
<div>
24+
<p>SASS is working!</p>
25+
</div>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// <reference types="cypress" />
2+
import App from './App.svelte'
3+
import { mount } from 'cypress-svelte-unit-test'
4+
5+
// example from https://daveceddia.com/svelte-with-sass-in-vscode/
6+
// Note: to have node-sass work correctly, must set
7+
// "nodeVersion": "system" in the "cypress.json"
8+
9+
/* eslint-env mocha */
10+
describe('Component with scss style', () => {
11+
it('has colors applied', () => {
12+
mount(App, {
13+
props: {
14+
name: 'Svelte',
15+
},
16+
})
17+
18+
// check if SASS styles were applied
19+
cy.contains('Hello Svelte!')
20+
.should('be.visible')
21+
.and('have.css', 'color', 'rgb(255, 0, 0)')
22+
23+
cy.contains('div', 'SASS is working!').should(
24+
'have.css',
25+
'background-color',
26+
'rgb(0, 128, 0)',
27+
)
28+
})
29+
})

0 commit comments

Comments
 (0)