Skip to content

Commit

Permalink
feat(CrowdStrike#62): tests for initial render
Browse files Browse the repository at this point in the history
- Currently failing, because there is a bug on initial render
- Hopefully they are conclusive
  • Loading branch information
Michal Bryxí committed Aug 4, 2021
1 parent cb186e7 commit 8de2110
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/integration/hash-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { mutationsSettled, scrollToHash } from 'ember-url-hash-polyfill';
import { setupRouter } from './-helpers';

import type RouterService from '@ember/routing/router-service';
import { currentURL } from '@ember/test-helpers';

module('Hash', function (hooks) {
setupApplicationTest(hooks);
Expand Down Expand Up @@ -38,6 +39,33 @@ module('Hash', function (hooks) {
);
}

module('initial page load', function (_hooks) {
test('waits for app to settle', async function (assert) {
this.owner.register(
'template:application',
hbs`
<h1 id="first">first!</h1>
<div style="height: 100vh;"></div>
<h1 id="second">second!</h1>
<div style="height: 100vh;"></div>
`
);

await visit('/#second');

let container = document.querySelector('#ember-testing-container');
let first = find('#first');
let second = find('#second');

debugAssert(`Expected all test elements to exist`, container && first && second);

assert.false(isVisible(first, container), 'first header is not visible');
assert.true(isVisible(second, container), 'second header is visible');
assert.equal(currentURL(), '/#second', 'initially, preserves hash');
});
});

module('linking with hashes', function (_hooks) {
test('in-page-links can be scrolled to with native anchors', async function (assert) {
this.owner.register(
Expand Down

0 comments on commit 8de2110

Please sign in to comment.