-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #961 from openkraken/feat/support-variable
feat: add css variables and support link element
- Loading branch information
Showing
26 changed files
with
779 additions
and
311 deletions.
There are no files selected for viewing
Binary file added
BIN
+9.01 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.37d8f5d81.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.63 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.5dde2c731.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.01 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.7111cb3c1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.07 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.8842e44c1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.67 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.af596f8a1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.33 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.e0b274c01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.43 KB
integration_tests/snapshots/css/css-variables/css-variables.ts.f52dfa971.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 167 additions & 0 deletions
167
integration_tests/specs/css/css-variables/css-variables.ts
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,167 @@ | ||
describe('CSS Variables', () => { | ||
// https://github.com/web-platform-tests/wpt/blob/master/css/css-variables/css-variable-change-style-001.html | ||
it('change-style-001', async () => { | ||
|
||
document.body.appendChild(createStyle(` | ||
.outer { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
} | ||
`)); | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
font-size: var(--z); | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">FontSize should be 28px.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
it('change-style-002', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
font-size: var(--z); | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">FontSize should be 28px.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
|
||
it('variable resolve color', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
background-color: var(--x); | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">Background should be red.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
describe('Shorthand CSS properties', () => { | ||
it('background', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
background: var(--y); | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">Background should be green.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
it('margin', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
margin: var(--z); | ||
background: red; | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">Background should be red with 28px margin.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
it('padding', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: red; | ||
--y: green; | ||
--z: 28px; | ||
padding: var(--z); | ||
background: red; | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">Background should be red with 28px padding.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
|
||
it('border', async () => { | ||
document.head.appendChild(createStyle(` | ||
.inner { | ||
--x: 4px; | ||
--y: solid; | ||
--z: green; | ||
border: var(--x) var(--y) var(--z); | ||
background: red; | ||
} | ||
`)); | ||
|
||
document.body.appendChild( | ||
<div class="outer"> | ||
<div class="inbetween"> | ||
<div class="inner">Background should be red with 4px green solid border.</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
await snapshot(); | ||
}); | ||
}); | ||
|
||
function createStyle(text) { | ||
const style = document.createElement('style'); | ||
style.appendChild(document.createTextNode(text)); | ||
return 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
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
Oops, something went wrong.