-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from 'chai'; | ||
import * as cheerio from 'cheerio'; | ||
import { loadFixture } from './test-utils.js'; | ||
|
||
describe('Object style', async () => { | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ root: './fixtures/astro-object-style/' }); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Passes style attributes as expected to elements', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('[style="background-color:green"]')).to.have.lengthOf(1); | ||
expect($('[style="background-color:red"]')).to.have.lengthOf(1); | ||
expect($('[style="background-color:blue"]')).to.have.lengthOf(1); | ||
expect($(`[style='background-image:url("a")']`)).to.have.lengthOf(1); | ||
}); | ||
|
||
it('Passes style attributes as expected to components', async () => { | ||
const html = await fixture.readFile('/component/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('[style="background-color:green"]')).to.have.lengthOf(1); | ||
expect($('[style="background-color:red"]')).to.have.lengthOf(1); | ||
expect($('[style="background-color:blue"]')).to.have.lengthOf(1); | ||
expect($(`[style='background-image:url("a")']`)).to.have.lengthOf(1); | ||
}); | ||
}); |
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 @@ | ||
{ | ||
"name": "@test/astro-class-list", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/astro/test/fixtures/astro-object-style/src/components/Span.astro
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 @@ | ||
<span {...Astro.props} /> |
10 changes: 10 additions & 0 deletions
10
packages/astro/test/fixtures/astro-object-style/src/pages/component.astro
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,10 @@ | ||
--- | ||
import Component from '../components/Span.astro' | ||
--- | ||
<Component style="background-color:green" /> | ||
|
||
<Component style={"background-color:red"} /> | ||
|
||
<Component style={{backgroundColor:"blue"}} /> | ||
|
||
<Component style={{backgroundImage:'url("a")'}} /> |
7 changes: 7 additions & 0 deletions
7
packages/astro/test/fixtures/astro-object-style/src/pages/index.astro
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,7 @@ | ||
<span style="background-color:green" /> | ||
|
||
<span style={"background-color:red"} /> | ||
|
||
<span style={{backgroundColor:"blue"}} /> | ||
|
||
<span style={{backgroundImage:'url("a")'}} /> |