Skip to content

Commit 7757124

Browse files
committed
fixing tests
1 parent 484f3d3 commit 7757124

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

ui/app/templates/components/job-editor/edit.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
<div class="boxed-section">
77
<Hds::CodeEditor
8+
data-test-editor
89
@value={{@data.job._newDefinition}}
910
@onInput={{@fns.onUpdate}}
1011
@language={{if (eq @data.format "json") "javascript" "ruby"}}

ui/app/templates/components/job-editor/read.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
<Hds::CodeBlock
5454
data-test-job-spec-view
5555
aria-label="Job specification"
56-
@value={{@data.Definition}}
56+
@value={{@data.definition}}
5757
@language={{if (eq @data.format "json") "javascript" "ruby"}}
5858
@hasLineWrapping={{@data.shouldWrap}}
5959
/>
6060
{{else}}
6161
<Hds::CodeBlock
6262
data-test-json-viewer
6363
aria-label="JSON Viewer"
64-
@value={{@data.Definition}}
64+
@value={{@data.definition}}
6565
@language="json"
6666
@hasLineWrapping={{@data.shouldWrap}}
6767
/>

ui/tests/integration/components/job-editor-test.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { assign } from '@ember/polyfills';
77
import { module, test } from 'qunit';
88
import { setupRenderingTest } from 'ember-qunit';
9-
import { render } from '@ember/test-helpers';
9+
import { render, waitFor } from '@ember/test-helpers';
1010
import hbs from 'htmlbars-inline-precompile';
1111
import { create } from 'ember-cli-page-object';
1212
import sinon from 'sinon';
@@ -97,12 +97,19 @@ module('Integration | Component | job-editor', function (hooks) {
9797
handleSaveAsTemplate: sinon.spy(),
9898
context: 'new',
9999
});
100+
100101
await render(commonTemplate);
102+
103+
return waitFor('.cm-editor');
101104
};
102105

103106
const planJob = async (spec) => {
104107
const cm = getCodeMirrorInstance(['data-test-editor']);
105-
cm.setValue(spec);
108+
109+
cm.dispatch({
110+
changes: { from: 0, to: cm.state.doc.length, insert: spec },
111+
});
112+
106113
await Editor.plan();
107114
};
108115

@@ -123,8 +130,12 @@ module('Integration | Component | job-editor', function (hooks) {
123130

124131
await renderNewJob(this, job);
125132

133+
await waitFor('.cm-editor');
134+
126135
const cm = getCodeMirrorInstance(['data-test-editor']);
127-
cm.setValue(spec);
136+
cm.dispatch({
137+
changes: { from: 0, to: cm.state.doc.length, insert: spec },
138+
});
128139
await Editor.plan();
129140

130141
const requests = this.server.pretender.handledRequests.mapBy('url');

0 commit comments

Comments
 (0)