Skip to content

Commit 53b9e9d

Browse files
authored
Merge pull request #172 from ember-learn/fix-page-title
Fix build for page-title change
2 parents 00143ef + cc75067 commit 53b9e9d

13 files changed

+483
-257
lines changed

.github/workflows/pull-requests.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/markdown/tutorial/part-1/01-orientation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ del package.json
182182
+ details.runtime = totalRuntime;
183183
+ });
184184
+
185-
+ QUnit.begin(function( details ) {
185+
+ QUnit.begin(details => {
186186
+ let ua = document.getElementById('qunit-userAgent');
187187
+ ua.innerText = ua.innerText.replace(/QUnit [0-9\.]+/g, 'QUnit');
188188
+ ua.innerText = ua.innerText.replace(/(WebKit|Chrome|Safari)\/[0-9\.]+/g, '$1');
@@ -265,7 +265,9 @@ The development server has a feature called *live reload*, which monitors your a
265265
As text on the welcome page pointed out, the source code for the page is located in `app/templates/application.hbs`. Let's try to edit that file and replace it with our own content:
266266
267267
```run:file:patch lang=handlebars cwd=super-rentals filename=app/templates/application.hbs
268-
@@ -1,5 +1 @@
268+
@@ -1,7 +1 @@
269+
-{{page-title "SuperRentals"}}
270+
-
269271
-{{!-- The following component displays Ember's default welcome message. --}}
270272
-<WelcomePage />
271273
-{{!-- Feel free to remove this! --}}

src/markdown/tutorial/part-1/02-building-pages.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ This time, we would like the page to be served on the `/about` URL. In order to
2929
The place to manage what pages are available is the *[router][TODO: link to router]*. Go ahead and open `app/router.js` and make the following change:
3030

3131
```run:file:patch lang=js cwd=super-rentals filename=app/router.js
32-
@@ -9,2 +9,3 @@
33-
Router.map(function() {
32+
@@ -8,2 +8,4 @@
33+
34+
-Router.map(function () {});
35+
+Router.map(function () {
3436
+ this.route('about');
35-
});
37+
+});
3638
```
3739

3840
This adds a *[route](../../../routing/defining-your-routes/)* named "about", which is served at the `/about` URL by default.

src/markdown/tutorial/part-1/03-automated-testing.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ In this case, we generated an *[acceptance test](../../../testing/test-types/#to
4545
git add tests/acceptance/super-rentals-test.js
4646
```
4747

48+
<!-- patch for https://github.com/emberjs/ember.js/issues/19333 -->
49+
50+
```run:file:patch hidden=true cwd=super-rentals filename=tests/acceptance/super-rentals-test.js
51+
@@ -4,6 +4,6 @@
52+
53+
-module('Acceptance | super rentals', function(hooks) {
54+
+module('Acceptance | super rentals', function (hooks) {
55+
setupApplicationTest(hooks);
56+
57+
- test('visiting /super-rentals', async function(assert) {
58+
+ test('visiting /super-rentals', async function (assert) {
59+
await visit('/super-rentals');
60+
```
61+
62+
```run:command hidden=true cwd=super-rentals
63+
git add tests/acceptance/super-rentals-test.js
64+
```
65+
66+
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
67+
4868
Generators aren't required; we *could* have created the file ourselves which would have accomplished the exact same thing. But, generators certainly save us a lot of typing. Go ahead and take a peek at the acceptance test file and see for yourself.
4969
5070
> Zoey says...
@@ -65,11 +85,11 @@ Let's open the generated test file and replace the boilerplate test with our own
6585
import { setupApplicationTest } from 'ember-qunit';
6686
@@ -7,6 +7,12 @@
6787

68-
- test('visiting /super-rentals', async function(assert) {
88+
- test('visiting /super-rentals', async function (assert) {
6989
- await visit('/super-rentals');
7090
-
7191
- assert.equal(currentURL(), '/super-rentals');
72-
+ test('visiting /', async function(assert) {
92+
+ test('visiting /', async function (assert) {
7393
+ await visit('/');
7494
+
7595
+ assert.equal(currentURL(), '/');
@@ -149,7 +169,7 @@ Let's practice what we learned by adding tests for the remaining pages:
149169
@@ -18,2 +18,26 @@
150170
});
151171
+
152-
+ test('visiting /about', async function(assert) {
172+
+ test('visiting /about', async function (assert) {
153173
+ await visit('/about');
154174
+
155175
+ assert.equal(currentURL(), '/about');
@@ -161,7 +181,7 @@ Let's practice what we learned by adding tests for the remaining pages:
161181
+ assert.equal(currentURL(), '/getting-in-touch');
162182
+ });
163183
+
164-
+ test('visiting /getting-in-touch', async function(assert) {
184+
+ test('visiting /getting-in-touch', async function (assert) {
165185
+ await visit('/getting-in-touch');
166186
+
167187
+ assert.equal(currentURL(), '/getting-in-touch');

src/markdown/tutorial/part-1/04-component-basics.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,39 @@ ember generate component-test jumbo
153153
git add tests/integration/components/jumbo-test.js
154154
```
155155

156+
<!-- patch for https://github.com/emberjs/ember.js/issues/19333 -->
157+
158+
```run:file:patch hidden=true cwd=super-rentals filename=tests/integration/components/jumbo-test.js
159+
@@ -5,8 +5,8 @@
160+
161+
-module('Integration | Component | jumbo', function(hooks) {
162+
+module('Integration | Component | jumbo', function (hooks) {
163+
setupRenderingTest(hooks);
164+
165+
- test('it renders', async function(assert) {
166+
+ test('it renders', async function (assert) {
167+
// Set any properties with this.set('myProperty', 'value');
168+
- // Handle any actions with this.set('myAction', function(val) { ... });
169+
+ // Handle any actions with this.set('myAction', function (val) { ... });
170+
171+
```
172+
173+
```run:command hidden=true cwd=super-rentals
174+
git add tests/integration/components/jumbo-test.js
175+
```
176+
177+
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
178+
156179
Here, we used the generator to generate a *[component test](../../../testing/testing-components/)*, also known as a rendering test. These are used to render and test a single component at a time. This is in contrast to the acceptance tests that we wrote earlier, which have to navigate and render entire pages worth of content.
157180
158181
Let's replace the boilerplate code that was generated for us with our own test:
159182
160183
```run:file:patch lang=js cwd=super-rentals filename=tests/integration/components/jumbo-test.js
161184
@@ -8,18 +8,8 @@
162185

163-
- test('it renders', async function(assert) {
186+
- test('it renders', async function (assert) {
164187
- // Set any properties with this.set('myProperty', 'value');
165-
- // Handle any actions with this.set('myAction', function(val) { ... });
188+
- // Handle any actions with this.set('myAction', function (val) { ... });
166189
-
167190
- await render(hbs`<Jumbo />`);
168191
-
@@ -176,7 +199,7 @@ Let's replace the boilerplate code that was generated for us with our own test:
176199
- `);
177200
-
178201
- assert.equal(this.element.textContent.trim(), 'template block text');
179-
+ test('it renders the content inside a jumbo header with a tomster', async function(assert) {
202+
+ test('it renders the content inside a jumbo header with a tomster', async function (assert) {
180203
+ await render(hbs`<Jumbo>Hello World</Jumbo>`);
181204
+
182205
+ assert.dom('.jumbo').exists();
@@ -282,7 +305,7 @@ But what kind of test? We *could* write a component test for the `<NavBar>` by i
282305
@@ -42,2 +48,20 @@
283306
});
284307
+
285-
+ test('navigating using the nav-bar', async function(assert) {
308+
+ test('navigating using the nav-bar', async function (assert) {
286309
+ await visit('/');
287310
+
288311
+ assert.dom('nav').exists();

src/markdown/tutorial/part-1/05-more-about-components.md

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,29 @@ git add app/components/rental.hbs
3131
git add tests/integration/components/rental-test.js
3232
```
3333

34+
<!-- patch for https://github.com/emberjs/ember.js/issues/19333 -->
35+
36+
```run:file:patch hidden=true cwd=super-rentals filename=tests/integration/components/rental-test.js
37+
@@ -5,8 +5,8 @@
38+
39+
-module('Integration | Component | rental', function(hooks) {
40+
+module('Integration | Component | rental', function (hooks) {
41+
setupRenderingTest(hooks);
42+
43+
- test('it renders', async function(assert) {
44+
+ test('it renders', async function (assert) {
45+
// Set any properties with this.set('myProperty', 'value');
46+
- // Handle any actions with this.set('myAction', function(val) { ... });
47+
+ // Handle any actions with this.set('myAction', function (val) { ... });
48+
49+
```
50+
51+
```run:command hidden=true cwd=super-rentals
52+
git add tests/integration/components/rental-test.js
53+
```
54+
55+
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
56+
3457
We will start by editing the template. Let's *[hard-code](https://en.wikipedia.org/wiki/Hard_coding)* the details for one rental property for now, and replace it with the real data from the server later on.
3558
3659
```run:file:patch lang=handlebars cwd=super-rentals filename=app/components/rental.hbs
@@ -61,9 +84,9 @@ Then, we will write a test to ensure all of the details are present. We will rep
6184
```run:file:patch lang=js cwd=super-rentals filename=tests/integration/components/rental-test.js
6285
@@ -8,18 +8,11 @@
6386

64-
- test('it renders', async function(assert) {
87+
- test('it renders', async function (assert) {
6588
- // Set any properties with this.set('myProperty', 'value');
66-
- // Handle any actions with this.set('myAction', function(val) { ... });
89+
- // Handle any actions with this.set('myAction', function (val) { ... });
6790
-
6891
- await render(hbs`<Rental />`);
6992
-
@@ -77,7 +100,7 @@ Then, we will write a test to ensure all of the details are present. We will rep
77100
- `);
78101
-
79102
- assert.equal(this.element.textContent.trim(), 'template block text');
80-
+ test('it renders information about a rental property', async function(assert) {
103+
+ test('it renders information about a rental property', async function (assert) {
81104
+ await render(hbs`<Rental />`);
82105
+
83106
+ assert.dom('article').hasClass('rental');
@@ -147,6 +170,30 @@ git add app/components/rental/image.hbs
147170
git add tests/integration/components/rental/image-test.js
148171
```
149172
173+
<!-- patch for https://github.com/emberjs/ember.js/issues/19333 -->
174+
175+
```run:file:patch hidden=true cwd=super-rentals filename=tests/integration/components/rental/image-test.js
176+
@@ -5,8 +5,8 @@
177+
178+
-module('Integration | Component | rental/image', function(hooks) {
179+
+module('Integration | Component | rental/image', function (hooks) {
180+
setupRenderingTest(hooks);
181+
182+
- test('it renders', async function(assert) {
183+
+ test('it renders', async function (assert) {
184+
// Set any properties with this.set('myProperty', 'value');
185+
- // Handle any actions with this.set('myAction', function(val) { ... });
186+
+ // Handle any actions with this.set('myAction', function (val) { ... });
187+
188+
```
189+
190+
```run:command hidden=true cwd=super-rentals
191+
git add tests/integration/components/rental/image-test.js
192+
```
193+
194+
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
195+
196+
150197
Components like these are known as *[namespaced](https://en.wikipedia.org/wiki/Namespace)* components. Namespacing allows us to organize our components by folders according to their purpose. This is completely optional&mdash;namespaced components are not special in any way.
151198
152199
## Forwarding HTML Attributes with `...attributes`
@@ -188,11 +235,11 @@ In general, it is a good idea to add `...attributes` to the primary element in y
188235
Let's write a test for our new component!
189236
190237
```run:file:patch lang=js cwd=super-rentals filename=tests/integration/components/rental/image-test.js
191-
@@ -8,18 +8,13 @@
238+
@@ -8,18 +8,15 @@
192239

193-
- test('it renders', async function(assert) {
240+
- test('it renders', async function (assert) {
194241
- // Set any properties with this.set('myProperty', 'value');
195-
- // Handle any actions with this.set('myAction', function(val) { ... });
242+
- // Handle any actions with this.set('myAction', function (val) { ... });
196243
-
197244
- await render(hbs`<Rental::Image />`);
198245
-
@@ -206,17 +253,19 @@ Let's write a test for our new component!
206253
- `);
207254
-
208255
- assert.equal(this.element.textContent.trim(), 'template block text');
209-
+ test('it renders the given image', async function(assert) {
256+
+ test('it renders the given image', async function (assert) {
210257
+ await render(hbs`
211258
+ <Rental::Image
212259
+ src="/assets/images/teaching-tomster.png"
213260
+ alt="Teaching Tomster"
214261
+ />
215262
+ `);
216263
+
217-
+ assert.dom('.image').exists();
218-
+ assert.dom('.image img').hasAttribute('src', '/assets/images/teaching-tomster.png');
219-
+ assert.dom('.image img').hasAttribute('alt', 'Teaching Tomster');
264+
+ assert
265+
+ .dom('.image img')
266+
+ .exists()
267+
+ .hasAttribute('src', '/assets/images/teaching-tomster.png')
268+
+ .hasAttribute('alt', 'Teaching Tomster');
220269
});
221270
```
222271

src/markdown/tutorial/part-1/06-interactive-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Finally, let's write a test for this new behavior:
240240
@@ -20,2 +21,26 @@
241241
});
242242
+
243-
+ test('clicking on the component toggles its size', async function(assert) {
243+
+ test('clicking on the component toggles its size', async function (assert) {
244244
+ await render(hbs`
245245
+ <Rental::Image
246246
+ src="/assets/images/teaching-tomster.png"

0 commit comments

Comments
 (0)