open-vault/ui/tests/integration/components/http-requests-dropdown-test.js
Noelle Daley 5cd7e924fe
Http request volume/dropdown (#7016)
* init dropdown

* add dropdown to storybook

* move http requests components into container

* add event handler for selecting new time window

* no need for this. in the template

* filter bar chart and table

* add bar chart transitions

* handle Last 12 Months in dropdown

* don't use fake data

* start tests

* add jsdoc and notes for storybook

* add container to storybook

* compute filteredCounters when counters change

* move static dropdown options to template

* add tests

* style the dropdown

* use this.elementId

* fix linting errors

* use ember array extensions

* use fillIn instead of page object and make dom assertions consistent

* calculate the correct percent change between months

* use data-test selector instead of id

* show plus or minus next to percent change
2019-07-03 10:46:40 -07:00

31 lines
946 B
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
const COUNTERS = [
{ start_time: '2018-04-01T00:00:00Z', total: 5500 },
{ start_time: '2019-05-01T00:00:00Z', total: 4500 },
{ start_time: '2019-06-01T00:00:00Z', total: 5000 },
];
module('Integration | Component | http-requests-dropdown', function(hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function() {
this.set('counters', COUNTERS);
});
test('it renders with options', async function(assert) {
await render(hbs`<HttpRequestsDropdown @counters={{counters}} />`);
assert.dom('[data-test-date-range]').hasValue('All', 'shows all data by default');
assert.equal(
this.element.querySelector('[data-test-date-range]').options.length,
4,
'it adds an option for each year in the data set'
);
});
});