open-nomad/ui/tests/unit/components/gauge-chart-test.js

28 lines
626 B
JavaScript
Raw Normal View History

2020-05-11 23:58:17 +00:00
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
2021-12-28 14:45:20 +00:00
module('Unit | Component | gauge-chart', function (hooks) {
2020-05-11 23:58:17 +00:00
setupTest(hooks);
2021-12-28 14:45:20 +00:00
hooks.beforeEach(function () {
2020-05-11 23:58:17 +00:00
this.subject = this.owner.factoryFor('component:gauge-chart');
});
2021-12-28 14:45:20 +00:00
test('percent is a function of value and total OR complement', function (assert) {
2020-05-11 23:58:17 +00:00
const chart = this.subject.create();
chart.setProperties({
value: 5,
total: 10,
});
assert.equal(chart.percent, 0.5);
chart.setProperties({
total: null,
complement: 15,
});
assert.equal(chart.percent, 0.25);
});
});