Skip to content

Commit 91d6079

Browse files
Add narrowly scoped test.
1 parent b89f547 commit 91d6079

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/compile/mark/encode/tooltip.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,25 @@ describe('compile/mark/encode/tooltip', () => {
8383
expect(props.tooltip).toEqual({signal: 'datum.datum'});
8484
});
8585

86+
it('generates tooltip signal for discrete encodings without a format and reactiveGeom is true', () => {
87+
const model = parseUnitModelWithScaleAndLayoutSize({
88+
mark: {
89+
type: 'circle',
90+
tooltip: true,
91+
},
92+
encoding: {
93+
color: {
94+
field: 'Foobar',
95+
type: 'nominal',
96+
},
97+
},
98+
});
99+
expect(tooltip(model, {reactiveGeom: true}).tooltip).toEqual({
100+
signal:
101+
'{"Foobar": isValid(datum.datum["Foobar"]) ? isArray(datum.datum["Foobar"]) ? join(datum.datum["Foobar"], \'\\n\') : datum.datum["Foobar"] : ""+datum.datum["Foobar"]}',
102+
});
103+
});
104+
86105
it('priorizes tooltip field def', () => {
87106
const model = parseUnitModelWithScaleAndLayoutSize({
88107
mark: {type: 'point', tooltip: {content: 'data'}},

0 commit comments

Comments
 (0)