Skip to content

Commit c71a251

Browse files
committedJan 22, 2025·
add margin of error for funnel restyle test
1 parent 8e0d77b commit c71a251

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎test/jasmine/tests/funnel_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,14 @@ describe('A funnel plot', function() {
591591
return node.querySelectorAll('g.point');
592592
}
593593

594-
function assertTextIsInsidePath(textNode, pathNode) {
594+
function assertTextIsInsidePath(textNode, pathNode, errorMargin=0) {
595595
var textBB = textNode.getBoundingClientRect();
596596
var pathBB = pathNode.getBoundingClientRect();
597597

598-
expect(pathBB.left).not.toBeGreaterThan(textBB.left);
599-
expect(textBB.right).not.toBeGreaterThan(pathBB.right);
600-
expect(pathBB.top).not.toBeGreaterThan(textBB.top);
601-
expect(textBB.bottom).not.toBeGreaterThan(pathBB.bottom);
598+
expect(pathBB.left - errorMargin).not.toBeGreaterThan(textBB.left);
599+
expect(textBB.right - errorMargin).not.toBeGreaterThan(pathBB.right);
600+
expect(pathBB.top - errorMargin).not.toBeGreaterThan(textBB.top);
601+
expect(textBB.bottom - errorMargin).not.toBeGreaterThan(pathBB.bottom);
602602
}
603603

604604
function assertTextIsAbovePath(textNode, pathNode) {
@@ -969,7 +969,7 @@ describe('A funnel plot', function() {
969969
assertTextIsInsidePath(text03, path03); // inside
970970
assertTextIsInsidePath(text12, path12); // inside
971971
assertTextIsInsidePath(text20, path20); // inside
972-
assertTextIsInsidePath(text30, path30); // inside
972+
assertTextIsInsidePath(text30, path30, 0.5); // inside
973973
})
974974
.then(done, done.fail);
975975
});

0 commit comments

Comments
 (0)
Please sign in to comment.