-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add visual tests for charts themes (#3335)
- Loading branch information
1 parent
b79a853
commit 03c37bb
Showing
9 changed files
with
160 additions
and
10 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 |
---|---|---|
@@ -1,15 +1,90 @@ | ||
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js'; | ||
import { visualDiff } from '@web/test-runner-visual-regression'; | ||
import '../../../vaadin-chart.js'; | ||
import '../../../theme/lumo/vaadin-chart.js'; | ||
|
||
describe('chart', () => { | ||
let element; | ||
|
||
beforeEach(() => { | ||
element = fixtureSync('<vaadin-chart title="The chart title"></vaadin-chart>'); | ||
describe('empty', () => { | ||
beforeEach(() => { | ||
element = fixtureSync('<vaadin-chart title="The chart title"></vaadin-chart>'); | ||
}); | ||
|
||
it('empty with title', async () => { | ||
await visualDiff(element, 'empty-title'); | ||
}); | ||
}); | ||
|
||
it('empty with title', async () => { | ||
await visualDiff(element, 'empty-title'); | ||
describe('pie', () => { | ||
beforeEach(() => { | ||
element = fixtureSync(` | ||
<vaadin-chart | ||
type="pie" | ||
additional-options='{ | ||
"plotOptions": { | ||
"series": { | ||
"animation": false | ||
} | ||
} | ||
}' | ||
> | ||
<vaadin-chart-series | ||
title="Brands" | ||
values='[ | ||
{ | ||
"name": "Chrome", | ||
"y": 70.7 | ||
}, | ||
{ | ||
"name": "Safari", | ||
"y": 8.9 | ||
}, | ||
{ | ||
"name": "Firefox", | ||
"y": 7.7 | ||
}, | ||
{ | ||
"name": "Edge", | ||
"y": 5.8 | ||
}, | ||
{ | ||
"name": "IE", | ||
"y": 2.1 | ||
}, | ||
{ | ||
"name": "QQ", | ||
"y": 2 | ||
}, | ||
{ | ||
"name": "Sogou Explorer", | ||
"y": 1.8 | ||
}, | ||
{ | ||
"name": "Yandex", | ||
"y": 0.9 | ||
}, | ||
{ | ||
"name": "Brave", | ||
"y": 0.1 | ||
} | ||
]' | ||
></vaadin-chart-series> | ||
</vaadin-chart> | ||
`); | ||
}); | ||
|
||
it('pie', async () => { | ||
await visualDiff(element, 'pie'); | ||
}); | ||
|
||
it('pie-gradient', async () => { | ||
element.setAttribute('theme', 'gradient'); | ||
await visualDiff(element, 'pie-gradient'); | ||
}); | ||
|
||
it('pie-monotone', async () => { | ||
element.setAttribute('theme', 'monotone'); | ||
await visualDiff(element, 'pie-monotone'); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+29.6 KB
packages/charts/test/visual/lumo/screenshots/chart/baseline/pie-gradient.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
+28.4 KB
packages/charts/test/visual/lumo/screenshots/chart/baseline/pie-monotone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,15 +1,90 @@ | ||
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js'; | ||
import { visualDiff } from '@web/test-runner-visual-regression'; | ||
import '../../../vaadin-chart.js'; | ||
import '../../../theme/material/vaadin-chart.js'; | ||
|
||
describe('chart', () => { | ||
let element; | ||
|
||
beforeEach(() => { | ||
element = fixtureSync('<vaadin-chart title="The chart title"></vaadin-chart>'); | ||
describe('empty', () => { | ||
beforeEach(() => { | ||
element = fixtureSync('<vaadin-chart title="The chart title"></vaadin-chart>'); | ||
}); | ||
|
||
it('empty with title', async () => { | ||
await visualDiff(element, 'empty-title'); | ||
}); | ||
}); | ||
|
||
it('empty with title', async () => { | ||
await visualDiff(element, 'empty-title'); | ||
describe('pie', () => { | ||
beforeEach(() => { | ||
element = fixtureSync(` | ||
<vaadin-chart | ||
type="pie" | ||
additional-options='{ | ||
"plotOptions": { | ||
"series": { | ||
"animation": false | ||
} | ||
} | ||
}' | ||
> | ||
<vaadin-chart-series | ||
title="Brands" | ||
values='[ | ||
{ | ||
"name": "Chrome", | ||
"y": 70.7 | ||
}, | ||
{ | ||
"name": "Safari", | ||
"y": 8.9 | ||
}, | ||
{ | ||
"name": "Firefox", | ||
"y": 7.7 | ||
}, | ||
{ | ||
"name": "Edge", | ||
"y": 5.8 | ||
}, | ||
{ | ||
"name": "IE", | ||
"y": 2.1 | ||
}, | ||
{ | ||
"name": "QQ", | ||
"y": 2 | ||
}, | ||
{ | ||
"name": "Sogou Explorer", | ||
"y": 1.8 | ||
}, | ||
{ | ||
"name": "Yandex", | ||
"y": 0.9 | ||
}, | ||
{ | ||
"name": "Brave", | ||
"y": 0.1 | ||
} | ||
]' | ||
></vaadin-chart-series> | ||
</vaadin-chart> | ||
`); | ||
}); | ||
|
||
it('pie', async () => { | ||
await visualDiff(element, 'pie'); | ||
}); | ||
|
||
it('pie-gradient', async () => { | ||
element.setAttribute('theme', 'gradient'); | ||
await visualDiff(element, 'pie-gradient'); | ||
}); | ||
|
||
it('pie-monotone', async () => { | ||
element.setAttribute('theme', 'monotone'); | ||
await visualDiff(element, 'pie-monotone'); | ||
}); | ||
}); | ||
}); |
Binary file modified
BIN
-416 Bytes
(91%)
packages/charts/test/visual/material/screenshots/chart/baseline/empty-title.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
+32.6 KB
packages/charts/test/visual/material/screenshots/chart/baseline/pie-gradient.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
+30.1 KB
packages/charts/test/visual/material/screenshots/chart/baseline/pie-monotone.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
+31.8 KB
packages/charts/test/visual/material/screenshots/chart/baseline/pie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.