Skip to content

Commit

Permalink
A11y audit etc
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Aug 30, 2022
1 parent 477f526 commit 59f87e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/allocation-service-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{#if @service}}
{{keyboard-commands this.keyCommands}}
<header class="detail-header">
<h1 class="title">Service Details for {{@service.name}}; {{@service.refID}}</h1>
<h1 class="title">Service Details for {{@service.name}}</h1>
<button
data-test-close-service-sidebar
class="button is-borderless"
Expand Down
2 changes: 1 addition & 1 deletion ui/app/controllers/allocations/allocation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class IndexController extends Controller.extend(Sortable) {
this.set('activeServiceID', service.refID);
}

@computed('activeServiceID')
@computed('activeServiceID', 'services')
get activeService() {
return this.services.findBy('refID', this.activeServiceID);
}
Expand Down
2 changes: 2 additions & 0 deletions ui/mirage/factories/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ export default Factory.extend({
if (task.withServices) {
const services = server.createList('service-fragment', 1, {
provider: 'nomad',
taskName: task.name,
});

services.push(
server.create('service-fragment', {
provider: 'consul',
taskName: task.name,
})
);
services.forEach((fragment) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';

module(
'Integration | Component | allocation-service-sidebar',
function (hooks) {
setupRenderingTest(hooks);

test('it supports basic open/close states', async function (assert) {
assert.expect(7);
await componentA11yAudit(this.element, assert);

this.set('closeSidebar', () => this.set('service', null));

this.set('service', { name: 'Funky Service' });
Expand All @@ -25,7 +29,8 @@ module(
assert.dom(this.element).hasText('');
assert.dom('.sidebar').doesNotHaveClass('open');

await click('[data-test-close-service-sidebar');
this.set('service', { name: 'Funky Service' });
await click('[data-test-close-service-sidebar]');
assert.dom(this.element).hasText('');
assert.dom('.sidebar').doesNotHaveClass('open');
});
Expand Down

0 comments on commit 59f87e8

Please sign in to comment.