Skip to content

Commit

Permalink
unit test condition moved to stubbable acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Nov 2, 2024
1 parent 9f4abff commit 22dc7db
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ui/app/styles/core/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ $secondaryNavbarHeight: 4.5rem;
display: flex;
align-items: center;

&.is-region {
&.single-region {
display: block;
padding: 0;
font-size: 1em;
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/region-switcher.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</PowerSelect>
</span>
{{else if this.system.hasNonDefaultRegion}}
<div class="navbar-item is-region">
<div class="navbar-item single-region">
<span>Region: </span>{{this.system.activeRegion}}
</div>
{{/if}}
6 changes: 4 additions & 2 deletions ui/tests/acceptance/regions-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,23 @@ module('Acceptance | regions (only one)', function (hooks) {
await a11yAudit(assert);
});

test('when there is only one region, the region switcher is not shown in the nav bar and the region is not in the page title', async function (assert) {
test('when there is only one region, and it is the default one, the region switcher is not shown in the nav bar and the region is not in the page title', async function (assert) {
server.create('region', { id: 'global' });

await JobsList.visit();

assert.notOk(Layout.navbar.regionSwitcher.isPresent, 'No region switcher');
assert.notOk(Layout.navbar.singleRegion.isPresent, 'No single region');
assert.ok(document.title.includes('Jobs'));
});

test('when the only region is not named "global", the region switcher still is not shown', async function (assert) {
test('when the only region is not named "global", the region switcher still is not shown, but the single region name is', async function (assert) {
server.create('region', { id: 'some-region' });

await JobsList.visit();

assert.notOk(Layout.navbar.regionSwitcher.isPresent, 'No region switcher');
assert.ok(Layout.navbar.singleRegion.isPresent, 'Single region');
});

test('pages do not include the region query param', async function (assert) {
Expand Down
5 changes: 5 additions & 0 deletions ui/tests/pages/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export default create({
}),
},

singleRegion: {
scope: '.single-region',
text: text(),
},

search: {
scope: '[data-test-search-parent]',

Expand Down
25 changes: 0 additions & 25 deletions ui/tests/unit/components/region-switcher-test.js

This file was deleted.

0 comments on commit 22dc7db

Please sign in to comment.