Skip to content

Commit 885315f

Browse files
committed
Fix tests after removing old files
1 parent f462347 commit 885315f

File tree

14 files changed

+110
-137
lines changed

14 files changed

+110
-137
lines changed

tests/acceptance/homepage/en-us-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ module('Acceptance | Homepage | en-US', function (hooks) {
4141
await visit('/');
4242

4343
assert
44-
.dom('#generating-files')
45-
.hasText('Generating Files', 'We see the site in English.');
44+
.dom('#fetching-data')
45+
.hasText('Fetching Data', 'We see the site in English.');
4646

4747
await fillIn('[data-test-field="Locale"]', 'pt-BR');
4848

4949
assert
50-
.dom('#generating-files')
51-
.hasText('Geração de arquivos', 'We see the site in Portugese (Brazil).');
50+
.dom('#fetching-data')
51+
.hasText('Buscando Dados', 'We see the site in Portugese (Brazil).');
5252

5353
await fillIn('[data-test-field="Locale"]', 'fr-FR');
5454

5555
assert
56-
.dom('#generating-files')
57-
.hasText('Génération de fichiers', 'We see the site in French.');
56+
.dom('#fetching-data')
57+
.hasText('Récupération des données', 'We see the site in French.');
5858
});
5959
});

tests/integration/components/code-snippet-test.js

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,17 @@ import { module, test } from 'qunit';
66
module('Integration | Component | code-snippet', function (hooks) {
77
setupRenderingTest(hooks);
88

9-
test('should render a Handlebars file', async function (assert) {
10-
await render(hbs`
11-
<CodeSnippet
12-
@fileName="component-properties/ddau/octane-parent.hbs"
13-
/>
14-
`);
15-
16-
assert
17-
.dom('[data-test-code-snippet]')
18-
.hasText(
19-
'{{!-- parent-component.hbs --}} <ChildComponent @plusOne={{this.plusOne}} /> Count: {{this.count}}'
20-
);
21-
});
22-
239
test('should render a JavaScript file', async function (assert) {
2410
await render(hbs`
2511
<CodeSnippet
26-
@fileName="component-properties/ddau/classic-parent.js"
12+
@fileName="fetching-data/find-record/new.js"
2713
/>
2814
`);
2915

3016
assert
3117
.dom('[data-test-code-snippet]')
3218
.hasText(
33-
"// parent-component.js import Component from '@ember/component'; export default Component.extend({ count: 0 });"
19+
"import { findRecord } from '@ember-data/json-api/request'; const result = await store.request(findRecord('user', '1')); const user = result.content.data"
3420
);
3521
});
36-
37-
test('should render a shell file', async function (assert) {
38-
await render(hbs`
39-
<CodeSnippet
40-
@fileName="generating-files/generating-component/classic.shell"
41-
/>
42-
`);
43-
44-
assert
45-
.dom('[data-test-code-snippet]')
46-
.hasText('ember generate component my-component');
47-
});
4822
});

tests/integration/components/guide-section-test.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@ module('Integration | Component | guide-section', function (hooks) {
2626

2727
test('should render', async function (assert) {
2828
this.section = {
29-
id: 'actions',
29+
id: 'fetching-data',
3030
subsections: [
3131
{
32-
id: 'actions',
33-
classicFiles: ['classic.js', 'classic.hbs'],
34-
octaneFiles: ['octane.js', 'octane.hbs'],
32+
id: 'find-record',
33+
classicFiles: ['old.js', 'old.ts'],
34+
octaneFiles: ['new.js', 'new.ts', 'own-builder.ts'],
3535
},
3636
{
37-
id: 'template-arguments-default',
38-
classicFiles: ['classic.hbs', 'classic.js'],
39-
octaneFiles: ['octane.hbs', 'octane.js'],
37+
id: 'find-all',
38+
classicFiles: ['old.js'],
39+
octaneFiles: ['new.js'],
4040
},
4141
{
42-
id: 'mixins',
43-
classicFiles: ['classic.js'],
44-
octaneDescriptionKey: 'actions.mixins.octaneDescription',
42+
id: 'query',
43+
classicFiles: ['old.js'],
44+
octaneFiles: ['new.js'],
45+
},
46+
{
47+
id: 'query-record',
48+
classicFiles: ['old.js'],
49+
octaneFiles: ['new.js'],
4550
},
4651
],
4752
};
@@ -52,10 +57,12 @@ module('Integration | Component | guide-section', function (hooks) {
5257
/>
5358
`);
5459

55-
assert.dom('[data-test-field="Section Title"]').includesText('Actions');
60+
assert
61+
.dom('[data-test-field="Section Title"]')
62+
.includesText('Fetching Data');
5663

57-
assert.dom('[data-test-subsection]').exists({ count: 3 });
58-
assert.dom('[data-test-code-snippet]').exists({ count: 9 });
59-
assert.dom('[data-test-general-text]').exists({ count: 1 });
64+
assert.dom('[data-test-subsection]').exists({ count: 4 });
65+
assert.dom('[data-test-code-snippet]').exists({ count: 11 });
66+
assert.dom('[data-test-general-text]').exists({ count: 0 });
6067
});
6168
});

tests/integration/components/guide-section/subsection-test.js

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
4242
});
4343

4444
test('should render (1)', async function (assert) {
45-
this.sectionId = 'generating-files';
45+
this.sectionId = 'fetching-data';
4646
this.subsection = {
47-
id: 'generating-component',
48-
classicFiles: ['classic.shell'],
49-
octaneFiles: ['octane.shell'],
47+
id: 'find-record',
48+
classicFiles: ['old.js', 'old.ts'],
49+
octaneFiles: ['new.js', 'new.ts', 'own-builder.ts'],
5050
};
5151

5252
await render(hbs`
@@ -56,44 +56,33 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
5656
/>
5757
`);
5858

59-
assert
60-
.dom('[data-test-field="Subsection Title"]')
61-
.hasText("Use an option to generate a component's JavaScript");
59+
assert.dom('[data-test-field="Subsection Title"]').hasText('findRecord');
6260

6361
assert
6462
.dom('[data-test-field="Subsection Description"]')
6563
.includesText(
66-
'In classic Ember, ember generate component created three files'
64+
'Examples here are shown for apps that use JSON:API. Apps using other paradigms should use the builders for REST or ActiveRecord if applicable, or author their own (or a new community lib!) if not.'
6765
);
6866

6967
const emberClassic = this.element.querySelector(
7068
'[data-test-ember-classic]'
7169
);
7270

73-
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 1 });
71+
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 2 });
7472
assert.dom('[data-test-general-text]', emberClassic).exists({ count: 0 });
7573

7674
const emberOctane = this.element.querySelector('[data-test-ember-octane]');
7775

78-
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 1 });
76+
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 3 });
7977
assert.dom('[data-test-general-text]', emberOctane).exists({ count: 0 });
8078
});
8179

8280
test('should render (2)', async function (assert) {
83-
this.sectionId = 'component-properties';
81+
this.sectionId = 'updating-data';
8482
this.subsection = {
85-
id: 'ddau',
86-
classicFiles: [
87-
'classic-parent.js',
88-
'classic-parent.hbs',
89-
'classic-child.js',
90-
'classic-child.hbs',
91-
],
92-
octaneFiles: [
93-
'octane-parent.js',
94-
'octane-parent.hbs',
95-
'octane-child.hbs',
96-
],
83+
id: 'create-record',
84+
classicFiles: ['old.js'],
85+
octaneFiles: ['in-place-body.js', 'handler.js'],
9786
};
9887

9988
await render(hbs`
@@ -103,33 +92,33 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
10392
/>
10493
`);
10594

106-
assert
107-
.dom('[data-test-field="Subsection Title"]')
108-
.hasText('Data Down, Actions Up');
95+
assert.dom('[data-test-field="Subsection Title"]').hasText('createRecord');
10996

11097
assert
11198
.dom('[data-test-field="Subsection Description"]')
112-
.includesText('Octane components enforce "Data Down, Actions Up."');
99+
.includesText(
100+
'To create a new record using Ember Data you should use createRecord request and attach "body" to it. In case of JSON:API backend - you can user serializeResources request utility.'
101+
);
113102

114103
const emberClassic = this.element.querySelector(
115104
'[data-test-ember-classic]'
116105
);
117106

118-
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 4 });
107+
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 1 });
119108
assert.dom('[data-test-general-text]', emberClassic).exists({ count: 0 });
120109

121110
const emberOctane = this.element.querySelector('[data-test-ember-octane]');
122111

123-
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 3 });
112+
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 2 });
124113
assert.dom('[data-test-general-text]', emberOctane).exists({ count: 0 });
125114
});
126115

127116
test('should render (3)', async function (assert) {
128-
this.sectionId = 'actions';
117+
this.sectionId = 'deleting-data';
129118
this.subsection = {
130-
id: 'mixins',
131-
classicFiles: ['classic.js'],
132-
octaneDescriptionKey: 'actions.mixins.octaneDescription',
119+
id: 'delete-record',
120+
classicFiles: ['old.js', 'destroy.js'],
121+
octaneFiles: ['new.js'],
133122
};
134123

135124
await render(hbs`
@@ -139,36 +128,34 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
139128
/>
140129
`);
141130

142-
assert.dom('[data-test-field="Subsection Title"]').hasText('Mixins');
131+
assert.dom('[data-test-field="Subsection Title"]').hasText('deleteRecord');
143132

144133
assert
145134
.dom('[data-test-field="Subsection Description"]')
146135
.includesText(
147-
'You cannot use mixins on anything that uses native class syntax'
136+
'To delete an existing record using Ember Data you should use deleteRecord builder to issue the request.'
148137
);
149138

150139
const emberClassic = this.element.querySelector(
151140
'[data-test-ember-classic]'
152141
);
153142

154-
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 1 });
143+
assert.dom('[data-test-code-snippet]', emberClassic).exists({ count: 2 });
155144
assert.dom('[data-test-general-text]', emberClassic).exists({ count: 0 });
156145

157146
const emberOctane = this.element.querySelector('[data-test-ember-octane]');
158147

159-
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 0 });
160-
assert.dom('[data-test-general-text]', emberOctane).exists({ count: 1 });
161-
assert
162-
.dom('[data-test-general-text]', emberOctane)
163-
.includesText('See Do you need Ember Object? for alternatives to mixins');
148+
assert.dom('[data-test-code-snippet]', emberOctane).exists({ count: 1 });
149+
assert.dom('[data-test-general-text]', emberOctane).exists({ count: 0 });
150+
assert.dom('[data-test-general-text]', emberOctane).doesNotExist();
164151
});
165152

166153
test('should render (4)', async function (assert) {
167-
this.sectionId = 'generating-files';
154+
this.sectionId = 'adapters';
168155
this.subsection = {
169-
id: 'generating-component',
170-
classicFiles: ['classic.shell'],
171-
octaneFiles: ['octane.shell'],
156+
id: 'host-and-namespace',
157+
classicFiles: ['old.js'],
158+
octaneFiles: ['new.js'],
172159
};
173160

174161
await render(hbs`
@@ -182,18 +169,18 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
182169
.dom('[data-test-link="Edit Translation"]')
183170
.hasAttribute(
184171
'href',
185-
'https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/generating-files/generating-component/en-us.yaml'
172+
'https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/adapters/host-and-namespace/en-us.yaml'
186173
);
187174
});
188175

189176
test('should render (5)', async function (assert) {
190177
this.set('intl.locale', 'pt-BR');
191178

192-
this.sectionId = 'generating-files';
179+
this.sectionId = 'serializers';
193180
this.subsection = {
194-
id: 'generating-component',
195-
classicFiles: ['classic.shell'],
196-
octaneFiles: ['octane.shell'],
181+
id: 'general',
182+
classicFiles: ['old.js'],
183+
octaneFiles: ['utils.js', 'app-code.js', 'handler.js'],
197184
};
198185

199186
await render(hbs`
@@ -207,7 +194,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
207194
.dom('[data-test-link="Edit Translation"]')
208195
.hasAttribute(
209196
'href',
210-
'https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/generating-files/generating-component/pt-br.yaml'
197+
'https://github.com/ember-learn/ember-data-request-service-cheat-sheet/edit/main/translations/serializers/general/pt-br.yaml'
211198
);
212199
});
213200
});

translations/de-de.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
layout:
22
application:
3-
logo-alt-text: 'Ember Octane: die neueste Edition von Ember.js'
4-
title: EmberData Request Service Cheat Sheet
3+
logo-alt-text: 'EmberData Request Service Spickzettel'
4+
title: EmberData Request Service Spickzettel
55
description-1: >
6-
Dieses Guide ist ein '<a href="https://emberjs.com/editions/octane" target="_blank" rel="noopener noreferrer">'Ember Octane'</a>'-Spickzettel.
7-
Sie finden nicht alles darin, aber es sollte Ihren Einstieg in Ember.js erleichtern.
8-
Pull Requests können auf '<a href="https://github.com/ember-learn/ember-data-request-service-cheat-sheet" target="_blank" rel="noopener noreferrer">'GitHub'</a>' eingereicht werden.
6+
Dieser Leitfaden ist ein Spickzettel für die Verwendung des '<a href="https://emberjs.com/editions/octane" target="_blank" rel="noopener noreferrer">EmberData-Anforderungsdienstes</a>'.
7+
Es deckt nicht alles ab, aber es sollte Ihnen den Einstieg erleichtern!
8+
PRs sind willkommen im '<a href="https://github.com/ember-learn/ember-data-request-service-cheat-sheet" target="_blank" rel="noopener noreferrer">'GitHub-Repository'</a>'.
99
description-2: >
10-
Sehen Sie in '<a href="https://guides.emberjs.com/release/upgrading/" target="_blank" rel="noopener noreferrer">'The Octane Upgrading Guide'</a>' nach, um sich über das Upgrade auf Octane zu informieren.
10+
Für detaillierte Informationen zu den Upgrade-Pfaden und Unterschieden im Vergleich zu älteren EmberData-Mustern, siehe '<a href="https://rfcs.emberjs.com/id/0860-ember-data-request-service/" target="_blank" rel="noopener noreferrer">den RFC für den EmberData-Anforderungsdienst</a>'.
1111
1212
component:
1313
guide-section:
1414
section: §
1515
subsection:
1616
classic: Classic
17-
octane: Octane
17+
octane: Request Service
1818
edit-translation-text: Übersetzung ändern
1919
locale-menu:
2020
locale-select:

translations/es.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
layout:
22
application:
3-
logo-alt-text: 'Ember Octane: la última edición de Ember.js'
4-
title: EmberData Request Service Cheat Sheet
3+
logo-alt-text: 'EmberData Request Service Cheat Sheet'
4+
title: Hoja de trucos del servicio de solicitud de EmberData
55
description-1: >
6-
Esta guía es una hoja de referencia para usar '<a href="https://emberjs.com/editions/octane" target="_blank" rel="noopener noreferrer">'Ember.js Octane'</a>'.
7-
No cubre todo, ¡pero debería ayudarlo a comenzar!
8-
PRs bienvenidos en '<a href="https://github.com/ember-learn/ember-data-request-service-cheat-sheet" target="_blank" rel="noopener noreferrer">'el repositorio de GitHub'</a>'.
6+
Esta guía es una hoja de trucos para usar el '<a href="https://emberjs.com/editions/octane" target="_blank" rel="noopener noreferrer">Servicio de solicitud de EmberData</a>'.
7+
No cubre todo, ¡pero te ayudará a empezar!
8+
Se aceptan PRs en '<a href="https://github.com/ember-learn/ember-data-request-service-cheat-sheet" target="_blank" rel="noopener noreferrer">'el repositorio de GitHub'</a>'.
99
description-2: >
10-
Para obtener información detallada sobre la ruta de actualización y las diferencias introducidas en Octane, vea '<a href="https://guides.emberjs.com/release/upgrading/" target="_blank" rel="noopener noreferrer">'The Octane Upgrading Guide'</a>'.
10+
Para obtener información detallada sobre las rutas de actualización y las diferencias en comparación con los patrones antiguos de EmberData, consulta '<a href="https://rfcs.emberjs.com/id/0860-ember-data-request-service/" target="_blank" rel="noopener noreferrer">el RFC para el Servicio de solicitud de EmberData</a>'.
1111
1212
component:
1313
guide-section:
1414
section: §
1515
subsection:
16-
classic: Classic
17-
octane: Octane
16+
classic: Older patterns
17+
octane: Request Service
1818
edit-translation-text: Editar traducción
1919
locale-menu:
2020
locale-select:

translations/fetching-data/de-de.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: Daten Abrufen

translations/fetching-data/es.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: Recuperacion de datos

translations/fetching-data/fr-fr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: Récupération des données

translations/fetching-data/ja.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: データの取得

0 commit comments

Comments
 (0)