mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Fixed tests expecting old theme settings screen
refs https://github.com/TryGhost/Team/issues/1164 - removed conditional logic for links on settings index now that the old theme settings routes do not exist - updated error handling test to use new design settings screens - modified templates' test attributes to work with new design - fixed `enableLabsFlag()` test helper error when fixtures have already been loaded
This commit is contained in:
parent
b0bf481a5f
commit
f253e2523d
@ -13,10 +13,10 @@
|
||||
<button type="button" {{on "click" (fn this.activateTheme theme.model dd)}} class="apps-configured-action darkgrey apps-configured-action-activate green-hover green-bg-hover" data-test-button="activate">Activate</button>
|
||||
{{/unless}}
|
||||
<GhBasicDropdown @verticalPosition="below" @horizontalPosition="right" @buttonPosition="right" as |dd|>
|
||||
<dd.Trigger class="gh-btn gh-btn-icon"><span>{{svg-jar "dotdotdot"}}</span></dd.Trigger>
|
||||
<dd.Trigger class="gh-btn gh-btn-icon" data-test-button="actions"><span>{{svg-jar "dotdotdot"}}</span></dd.Trigger>
|
||||
|
||||
<dd.Content class="relative-dropdown-menu">
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown-menu" data-test-actions-for={{theme.name}}>
|
||||
|
||||
<li><button type="button" {{on "click" (fn this.downloadTheme theme.name dd)}} class="darkgrey darkgrey-hover lightgrey-bg-hover" data-test-button="download">Download</button></li>
|
||||
|
||||
|
@ -14,7 +14,7 @@ export default class GhThemeTableComponent extends Component {
|
||||
|
||||
willDestroy() {
|
||||
super.willDestroy(...arguments);
|
||||
this.confirmDeleteModal?.close();
|
||||
this.confirmDeleteModal?.close?.();
|
||||
this.activateTaskInstance?.cancel();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="modal-content" {{on-key "Enter" (perform this.deleteThemeTask)}}>
|
||||
<header class="modal-header" data-test-modal="delete-theme">
|
||||
<div class="modal-content" {{on-key "Enter" (perform this.deleteThemeTask)}} data-test-modal="delete-theme">
|
||||
<header class="modal-header">
|
||||
<h1>Are you sure you want to delete this?</h1>
|
||||
</header>
|
||||
<button type="button" class="close" role="button" title="Close" {{on "click" @close}}>{{svg-jar "close"}}<span class="hidden">Close</span></button>
|
||||
@ -15,6 +15,6 @@
|
||||
@successText="Deleted"
|
||||
@task={{this.deleteThemeTask}}
|
||||
@class="gh-btn gh-btn-red gh-btn-icon"
|
||||
data-test-button="delete" />
|
||||
data-test-button="confirm" />
|
||||
</div>
|
||||
</div>
|
@ -15,30 +15,13 @@
|
||||
<p>Basic publication details and site metadata</p>
|
||||
</div>
|
||||
</LinkTo>
|
||||
{{#if (feature "customThemeSettings")}}
|
||||
<LinkTo class="gh-setting-group" @route="settings.design" data-test-nav="design">
|
||||
<span class="blue">{{svg-jar "paint-palette"}}</span>
|
||||
<div>
|
||||
<h4>Design</h4>
|
||||
<p>Customize your site and manage themes</p>
|
||||
</div>
|
||||
</LinkTo>
|
||||
{{else}}
|
||||
<button type="button" class="gh-setting-group" {{action (toggle "showBrandingModal" this)}} data-test-nav="branding">
|
||||
<span class="blue">{{svg-jar "paint-palette"}}</span>
|
||||
<div>
|
||||
<h4>Branding</h4>
|
||||
<p>Upload site logo and set accent color</p>
|
||||
</div>
|
||||
</button>
|
||||
<LinkTo class="gh-setting-group" @route="settings.theme" data-test-nav="theme">
|
||||
<span class="green">{{svg-jar "view-site"}}</span>
|
||||
<div>
|
||||
<h4>Theme</h4>
|
||||
<p>Install and update themes</p>
|
||||
</div>
|
||||
</LinkTo>
|
||||
{{/if}}
|
||||
<LinkTo class="gh-setting-group" @route="settings.design" data-test-nav="design">
|
||||
<span class="blue">{{svg-jar "paint-palette"}}</span>
|
||||
<div>
|
||||
<h4>Design</h4>
|
||||
<p>Customize your site and manage themes</p>
|
||||
</div>
|
||||
</LinkTo>
|
||||
<LinkTo class="gh-setting-group" @route="settings.navigation" data-test-nav="navigation">
|
||||
<span class="pink">{{svg-jar "compass-2"}}</span>
|
||||
<div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
import Mirage from 'ember-cli-mirage';
|
||||
import enableLabsFlag from '../helpers/enable-labs-flag';
|
||||
import {authenticateSession} from 'ember-simple-auth/test-support';
|
||||
import {beforeEach, describe, it} from 'mocha';
|
||||
import {click, currentRouteName, fillIn, find, findAll, visit} from '@ember/test-helpers';
|
||||
@ -106,11 +107,16 @@ describe('Acceptance: Error Handling', function () {
|
||||
});
|
||||
|
||||
it('handles ember-ajax HTML response', async function () {
|
||||
enableLabsFlag(this.server, 'customThemeSettings');
|
||||
|
||||
this.server.del('/themes/foo/', htmlErrorResponse);
|
||||
|
||||
await visit('/settings/theme');
|
||||
await click('[data-test-theme-id="foo"] [data-test-theme-delete-button]');
|
||||
await click('.fullscreen-modal [data-test-delete-button]');
|
||||
await visit('/settings/design/change-theme');
|
||||
|
||||
await click('[data-test-button="toggle-advanced"]');
|
||||
await click('[data-test-theme-id="foo"] [data-test-button="actions"]');
|
||||
await click('[data-test-actions-for="foo"] [data-test-button="delete"]');
|
||||
await click('[data-test-modal="delete-theme"] [data-test-button="confirm"]');
|
||||
|
||||
expect(findAll('.gh-alert').length).to.equal(1);
|
||||
expect(find('.gh-alert').textContent).to.not.match(/html>/);
|
||||
|
@ -1,11 +1,17 @@
|
||||
export default function (server, flag) {
|
||||
server.loadFixtures('configs');
|
||||
if (!server.schema.configs.all().length) {
|
||||
server.loadFixtures('configs');
|
||||
}
|
||||
|
||||
if (!server.schema.settings.all().length) {
|
||||
server.loadFixtures('settings');
|
||||
}
|
||||
|
||||
const config = server.schema.configs.first();
|
||||
config.update({enableDeveloperExperiments: true});
|
||||
|
||||
const labsSetting = {};
|
||||
labsSetting[flag] = true;
|
||||
|
||||
server.loadFixtures('settings');
|
||||
server.db.settings.update({key: 'labs'}, {value: JSON.stringify(labsSetting)});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user