Skip to content

Commit 4e70f06

Browse files
committed
more tests
1 parent b192a01 commit 4e70f06

7 files changed

Lines changed: 96 additions & 17 deletions
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

test/output/tipLongTextEllipsisMiddle.svg renamed to test/output/tipTextOverflowEllipsisEnd.svg

Lines changed: 2 additions & 2 deletions
Loading

test/output/tipLongTextEllipsisStart.svg renamed to test/output/tipTextOverflowEllipsisMiddle.svg

Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 31 additions & 0 deletions
Loading
Lines changed: 31 additions & 0 deletions
Loading

test/plots/tip.ts

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,43 @@ test(async function tipLineY() {
182182
return Plot.lineY(aapl, {x: "Date", y: "Close", tip: true}).plot();
183183
});
184184

185-
test(async function tipLongText() {
186-
return Plot.tip([{x: "Long sentence that gets cropped after a certain length"}], {x: "x"}).plot();
185+
test(async function tipTextOverflowNull() {
186+
return Plot.tip([{x: "Long sentence that does not get clipped no matter how long it gets; it can be really long"}], {
187+
x: "x",
188+
textOverflow: null,
189+
anchor: "top" // otherwise it would be bottom
190+
}).plot();
191+
});
192+
193+
test(async function tipTextOverflowClipEnd() {
194+
return Plot.tip([{x: "Long sentence that gets clipped at the end"}], {
195+
x: "x",
196+
textOverflow: "clip" // shorthand for "clip-end"
197+
}).plot();
198+
});
199+
200+
test(async function tipTextOverflowDefault() {
201+
return Plot.tip([{x: "Long sentence that gets an ellipsis at the end"}], {
202+
x: "x"
203+
}).plot();
187204
});
188205

189-
test(async function tipLongTextEllipsisEnd() {
190-
return Plot.tip([{x: "Long sentence that gets clipped at the end after a certain length"}], {
206+
test(async function tipTextOverflowEllipsisEnd() {
207+
return Plot.tip([{x: "Long sentence that gets an ellipsis at the end"}], {
191208
x: "x",
192-
textOverflow: "ellipsis" // "ellipsis-end"
209+
textOverflow: "ellipsis" // shorthand for "ellipsis-end"
193210
}).plot();
194211
});
195212

196-
test(async function tipLongTextEllipsisMiddle() {
197-
return Plot.tip([{x: "Long sentence that gets clipped in the middle after a certain length"}], {
213+
test(async function tipTextOverflowEllipsisMiddle() {
214+
return Plot.tip([{x: "Long sentence that gets an ellipsis in the middle"}], {
198215
x: "x",
199216
textOverflow: "ellipsis-middle"
200217
}).plot();
201218
});
202219

203-
test(async function tipLongTextEllipsisStart() {
204-
return Plot.tip([{x: "Long sentence that gets clipped at the start after a certain length"}], {
220+
test(async function tipTextOverflowEllipsisStart() {
221+
return Plot.tip([{x: "Long sentence that gets an ellipsis at the start"}], {
205222
x: "x",
206223
textOverflow: "ellipsis-start"
207224
}).plot();

0 commit comments

Comments
 (0)