-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(aria): 设置无障碍标签 * docs: add aria document
- Loading branch information
Showing
4 changed files
with
84 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Chart } from '../../../src'; | ||
import { CITY_SALE } from '../../util/data'; | ||
import { createDiv } from '../../util/dom'; | ||
|
||
describe('Chart aria', () => { | ||
const div = createDiv(); | ||
|
||
const chart = new Chart({ | ||
container: div, | ||
autoFit: true, | ||
}); | ||
|
||
chart.data(CITY_SALE); | ||
|
||
chart.interval().position('city*sale').color('category').adjust('stack'); | ||
|
||
test('aria', () => { | ||
|
||
const label = '不同城市按照产品类别的堆积柱形图。'; | ||
|
||
chart.aria({ | ||
label, | ||
}); | ||
|
||
expect(chart.ele.getAttribute('aria-label')).toBe(label); | ||
|
||
chart.aria(false); | ||
expect(chart.ele.getAttribute('aria-label')).toBe(null); | ||
|
||
chart.aria({ | ||
label, | ||
}); | ||
|
||
chart.destroy(); | ||
|
||
expect(div.getAttribute('aria-label')).toBe(null); | ||
}); | ||
|
||
}); |