0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:18:42 -05:00

Fixed tests that compared .textContent instead of .innerText with inline SVGs

refs 038600c350

- SVGs have titles now and title text content will be included in `element.textContent`
- updated tests that failed to use `.innerText` instead
  - via chai-dom's `.rendered.text()`
  - via direct access `find('.elem').innerText).to...`
This commit is contained in:
Kevin Ansfield 2022-09-01 10:01:23 +01:00
parent d0103a6b31
commit 04c3de8ffc
2 changed files with 8 additions and 8 deletions

View file

@ -191,26 +191,26 @@ describe('Acceptance: Content', function () {
expect(find('[data-test-nav-custom="posts-My posts"]')).to.exist;
// screen has default title and sidebar is showing inactive custom view
expect(find('[data-test-screen-title]').textContent.trim()).to.equal('Posts');
expect(find('[data-test-screen-title]')).to.have.rendered.text('Posts');
expect(find('[data-test-nav="posts"]')).to.have.class('active');
// clicking sidebar custom view link works
await click('[data-test-nav-custom="posts-Scheduled"]');
expect(currentURL()).to.equal('/posts?type=scheduled');
expect(find('[data-test-screen-title]').textContent.trim()).to.match(/Posts[ \n]+Scheduled/);
expect(find('[data-test-screen-title]').innerText).to.match(/Posts[\n\s]+Scheduled/);
expect(find('[data-test-nav-custom="posts-Scheduled"]')).to.have.class('active');
// clicking the main posts link resets
await click('[data-test-nav="posts"]');
expect(currentURL()).to.equal('/posts');
expect(find('[data-test-screen-title]').textContent.trim()).to.equal('Posts');
expect(find('[data-test-screen-title]')).to.have.rendered.text('Posts');
expect(find('[data-test-nav-custom="posts-Scheduled"]')).to.not.have.class('active');
// changing a filter to match a custom view shows custom view
await selectChoose('[data-test-type-select]', 'Scheduled posts');
expect(currentURL()).to.equal('/posts?type=scheduled');
expect(find('[data-test-nav-custom="posts-Scheduled"]')).to.have.class('active');
expect(find('[data-test-screen-title]').textContent.trim()).to.match(/Posts[ \n]+Scheduled/);
expect(find('[data-test-screen-title]').innerText).to.match(/Posts[\n\s]+Scheduled/);
});
});

View file

@ -380,11 +380,11 @@ describe('Acceptance: Publish flow', function () {
expect(
find('[data-test-setting="publish-type"] [data-test-setting-title]'), 'publish type title'
).to.have.trimmed.text('Publish');
).to.have.trimmed.rendered.text('Publish');
expect(
find('[data-test-setting="email-recipients"] [data-test-setting-title]'), 'recipients title'
).to.have.trimmed.text('Not sent as newsletter');
).to.have.trimmed.rendered.text('Not sent as newsletter');
await click('[data-test-setting="publish-type"] [data-test-setting-title]');
@ -408,7 +408,7 @@ describe('Acceptance: Publish flow', function () {
expect(
find('[data-test-setting="publish-type"] [data-test-setting-title]'), 'publish type title'
).to.have.trimmed.text('Publish');
).to.have.trimmed.rendered.text('Publish');
await click('[data-test-setting="publish-type"] [data-test-setting-title]');
@ -431,7 +431,7 @@ describe('Acceptance: Publish flow', function () {
expect(
find('[data-test-setting="publish-type"] [data-test-setting-title]'), 'publish type title'
).to.have.trimmed.text('Publish');
).to.have.trimmed.rendered.text('Publish');
await click('[data-test-setting="publish-type"] [data-test-setting-title]');