MCPcopy Index your code
hub / github.com/plotly/plotly.js / assert

Function assert

test/jasmine/assets/check_transitions.js:89–110  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

87// [ms since start of transition, selector, (attr|style), name of attribute, array of values to be found]
88// Ex.: [0, '.point path', 'style', 'fill', ['rgb(31, 119, 180)', 'rgb(31, 119, 180)', 'rgb(31, 119, 180)']]
89function assert(test) {
90 var msg = 'at ' + test[0] + 'ms, selection ' + test[1] + ' has ' + test[3];
91 var cur = [];
92 d3SelectAll(test[1]).each(function(d, i) {
93 if(test[2] === 'style') cur[i] = this.style[test[3]];
94 else if(test[2] === 'attr') cur[i] = d3Select(this).attr(test[3]);
95 else if(test[2] === 'datum') {
96 cur[i] = d3Select(this).datum()[test[3]];
97 }
98 });
99 switch(test[3]) {
100 case 'd':
101 assertEqual(cur, test[4], round, msg);
102 break;
103 case 'transform':
104 assertCloseTo(cur, test[4], 3, extractNumbers, msg);
105 break;
106 default:
107 assertEqual(cur, test[4], Lib.identity, msg);
108 }
109 return Promise.resolve(true);
110}
111
112function assertEqual(A, B, cb, msg) {
113 var a = cb(A);

Callers 4

testShapeComboFunction · 0.70
testImageComboFunction · 0.70
testAnnotationComboFunction · 0.70

Calls 2

assertEqualFunction · 0.85
assertCloseToFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…