Job spec upload (#14747)

* Job spec upload by click or drag

* pseudo-restrict formats

* Changelog

* Tweak to job spec upload to be above editor layer

* Within the job-editor again tho

* Beginning testcase cleanup

* Test progression

* refact: update codemirror fillin logic

Co-authored-by: Jai Bhagat <jaybhagat841@gmail.com>
This commit is contained in:
Phil Renaud
2022-11-02 10:34:10 -04:00
committed by GitHub
parent 152f8af960
commit 8a95f12390
6 changed files with 50 additions and 62 deletions

View File

@@ -105,59 +105,29 @@ module('Integration | Component | job-editor', function (hooks) {
};
const planJob = async (spec) => {
await Editor.editor.fillIn(spec);
const cm = getCodeMirrorInstance(['data-test-editor']);
cm.setValue(spec);
await Editor.plan();
};
test('the default state is an editor with an explanation popup', async function (assert) {
assert.expect(3);
assert.expect(2);
const job = await this.store.createRecord('job');
await renderNewJob(this, job);
assert.ok(
Editor.editorHelp.isPresent,
'Editor explanation popup is present'
);
assert.ok(Editor.editor.isPresent, 'Editor is present');
await componentA11yAudit(this.element, assert);
});
test('the explanation popup can be dismissed', async function (assert) {
const job = await this.store.createRecord('job');
await renderNewJob(this, job);
await Editor.editorHelp.dismiss();
assert.notOk(
Editor.editorHelp.isPresent,
'Editor explanation popup is gone'
);
assert.equal(
window.localStorage.nomadMessageJobEditor,
'false',
'Dismissal is persisted in localStorage'
);
});
test('the explanation popup is not shown once the dismissal state is set in localStorage', async function (assert) {
window.localStorage.nomadMessageJobEditor = 'false';
const job = await this.store.createRecord('job');
await renderNewJob(this, job);
assert.notOk(
Editor.editorHelp.isPresent,
'Editor explanation popup is gone'
);
});
test('submitting a json job skips the parse endpoint', async function (assert) {
const spec = jsonJob();
const job = await this.store.createRecord('job');
await renderNewJob(this, job);
await planJob(spec);
console.log('wait');
const requests = this.server.pretender.handledRequests.mapBy('url');
assert.notOk(
requests.includes('/v1/jobs/parse'),

View File

@@ -28,13 +28,6 @@ export default () => ({
dismiss: clickable('[data-test-plan-help-dismiss]'),
},
editorHelp: {
isPresent: isPresent('[data-test-editor-help-title]'),
title: text('[data-test-editor-help-title]'),
message: text('[data-test-editor-help-message]'),
dismiss: clickable('[data-test-editor-help-dismiss]'),
},
editor: {
isPresent: isPresent('[data-test-editor]'),
contents: code('[data-test-editor]'),