Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: for interactive charts, changed cursor to pointer (also updated tests) #9305

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compile/mark/mark.ts
Expand Up @@ -313,6 +313,7 @@ function getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix:
const key = encoding.key;
const sort = getSort(model);
const interactive = interactiveFlag(model);
interactive ? (model.markDef.cursor ??= 'pointer') : {};
const aria = getMarkPropOrConfig('aria', markDef, config);

const postEncodingTransform = markCompiler[mark].postEncodingTransform
Expand Down
14 changes: 14 additions & 0 deletions test/compile/compile.test.ts
Expand Up @@ -573,3 +573,17 @@ describe('compile/compile', () => {
expect(spec.autosize['resize']).toBeTruthy();
});
});

it('should generate right cursor', () => {
const {spec} = compile({
data: {url: 'data/population.json'},
params: [{name: 'select', select: 'point'}],
mark: 'bar',
encoding: {
x: {field: 'a', type: 'ordinal'},
y: {field: 'b', type: 'quantitative'}
}
});

expect(spec.marks[0].encode.update.cursor).toEqual({value: 'pointer'});
});
9 changes: 9 additions & 0 deletions test/compile/selection/layers.test.ts
Expand Up @@ -81,6 +81,9 @@ describe('Layered Selections', () => {
ariaRoleDescription: {
value: 'circle'
},
cursor: {
value: 'pointer'
},
description: {
signal:
'"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])'
Expand Down Expand Up @@ -129,6 +132,9 @@ describe('Layered Selections', () => {
ariaRoleDescription: {
value: 'square'
},
cursor: {
value: 'pointer'
},
description: {
signal:
'"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])'
Expand Down Expand Up @@ -172,6 +178,9 @@ describe('Layered Selections', () => {
ariaRoleDescription: {
value: 'point'
},
cursor: {
value: 'pointer'
},
description: {
signal:
'"Horsepower: " + (format(datum["Horsepower"], "")) + "; Miles_per_Gallon: " + (format(datum["Miles_per_Gallon"], "")) + "; Origin: " + (isValid(datum["Origin"]) ? datum["Origin"] : ""+datum["Origin"])'
Expand Down