From 5d13a8dab6176248020cadde98f110ed8ec6abd9 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 17 Apr 2022 14:46:29 +0900 Subject: [PATCH] add test --- .../Slider.svelte | 17 ++++++++ .../_config.js | 41 +++++++++++++++++++ .../main.svelte | 25 +++++++++++ .../Slider.svelte | 17 ++++++++ .../_config.js | 27 ++++++++++++ .../main.svelte | 17 ++++++++ 6 files changed, 144 insertions(+) create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/Slider.svelte create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/_config.js create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/main.svelte create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties/Slider.svelte create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties/_config.js create mode 100644 test/runtime-puppeteer/samples/svelte-component-css-custom-properties/main.svelte diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/Slider.svelte b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/Slider.svelte new file mode 100644 index 0000000000..4863966f85 --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/Slider.svelte @@ -0,0 +1,17 @@ + + +
+

Slider

+ Track +
+ + \ No newline at end of file diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/_config.js b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/_config.js new file mode 100644 index 0000000000..96965c223b --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/_config.js @@ -0,0 +1,41 @@ +export default { + props: { + railColor1: 'black', + trackColor1: 'red', + railColor2: 'green', + trackColor2: 'blue' + }, + html: ` +
+
+

Slider

+ Track +
+
+
+
+

Slider

+ Track +
+
+ `, + test({ component, assert, target }) { + component.railColor1 = 'yellow'; + component.trackColor2 = 'orange'; + + assert.htmlEqual(target.innerHTML, ` +
+
+

Slider

+ Track +
+
+
+
+

Slider

+ Track +
+
+ `); + } +}; diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/main.svelte b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/main.svelte new file mode 100644 index 0000000000..00be45a8a4 --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties-dynamic/main.svelte @@ -0,0 +1,25 @@ + + + + + diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/Slider.svelte b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/Slider.svelte new file mode 100644 index 0000000000..4863966f85 --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/Slider.svelte @@ -0,0 +1,17 @@ + + +
+

Slider

+ Track +
+ + \ No newline at end of file diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/_config.js b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/_config.js new file mode 100644 index 0000000000..9c3b7cbdea --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/_config.js @@ -0,0 +1,27 @@ +export default { + html: ` +
+
+

Slider

+ Track +
+
+
+
+

Slider

+ Track +
+
+ `, + test({ target, window, assert }) { + const railColor1 = target.querySelector('#slider-1 p'); + const trackColor1 = target.querySelector('#slider-1 span'); + const railColor2 = target.querySelector('#slider-2 p'); + const trackColor2 = target.querySelector('#slider-2 span'); + + assert.htmlEqual(window.getComputedStyle(railColor1).color, 'rgb(0, 0, 0)'); + assert.htmlEqual(window.getComputedStyle(trackColor1).color, 'rgb(255, 0, 0)'); + assert.htmlEqual(window.getComputedStyle(railColor2).color, 'rgb(0, 255, 0)'); + assert.htmlEqual(window.getComputedStyle(trackColor2).color, 'rgb(0, 0, 255)'); + } +}; diff --git a/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/main.svelte b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/main.svelte new file mode 100644 index 0000000000..47fc997b73 --- /dev/null +++ b/test/runtime-puppeteer/samples/svelte-component-css-custom-properties/main.svelte @@ -0,0 +1,17 @@ + + + + +