mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fix test (#9721)
Backports PR #9448 The assertion to determine skipping was wrong. This almost always returned true.
This commit is contained in:
parent
672db67f72
commit
15ad03f4b4
2 changed files with 17 additions and 5 deletions
|
@ -440,9 +440,12 @@ describe('tag cloud tests', function () {
|
|||
|
||||
|
||||
const centered = (largest[1] === 0 && largest[2] === 0);
|
||||
const halfWidth = debugInfo.size.width / 2;
|
||||
const halfHeight = debugInfo.size.height / 2;
|
||||
const inside = debugInfo.positions.filter(position => {
|
||||
return debugInfo.size[0] <= position[1] && position[1] <= debugInfo.size[0]
|
||||
&& debugInfo.size[1] <= position[2] && position[2] <= debugInfo.size[1];
|
||||
const x = position.x + halfWidth;
|
||||
const y = position.y + halfHeight;
|
||||
return 0 <= x && x <= debugInfo.size.width && 0 <= y && y <= debugInfo.size.height;
|
||||
});
|
||||
|
||||
return centered && inside.length === count - 1;
|
||||
|
@ -452,7 +455,6 @@ describe('tag cloud tests', function () {
|
|||
function handleExpectedBlip(assertion) {
|
||||
return function () {
|
||||
if (!shouldAssert()) {
|
||||
console.warn('Skipping assertion.');
|
||||
return;
|
||||
}
|
||||
assertion();
|
||||
|
|
|
@ -307,8 +307,18 @@ class TagCloud extends EventEmitter {
|
|||
*/
|
||||
getDebugInfo() {
|
||||
const debug = {};
|
||||
debug.positions = this._currentJob ? this._currentJob.words.map(tag => [tag.text, tag.x, tag.y, tag.rotate]) : [];
|
||||
debug.size = this._size.slice();
|
||||
debug.positions = this._currentJob ? this._currentJob.words.map(tag => {
|
||||
return {
|
||||
text: tag.text,
|
||||
x: tag.x,
|
||||
y: tag.y,
|
||||
rotate: tag.rotate
|
||||
};
|
||||
}) : [];
|
||||
debug.size = {
|
||||
width: this._size[0],
|
||||
height: this._size[1]
|
||||
};
|
||||
return debug;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue