You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
67
-
68
48
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.
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
178
-
179
156
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.
180
157
181
158
Let's replace the boilerplate code that was generated for us with our own test:
@@ -185,11 +162,11 @@ Let's replace the boilerplate code that was generated for us with our own test:
185
162
186
163
-test('it renders', asyncfunction (assert) {
187
164
-// Set any properties with this.set('myProperty', 'value');
188
-
-// Handle any actions with this.set('myAction', function(val) { ... });
165
+
-// Handle any actions with this.set('myAction', function(val) { ... });
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
56
-
57
34
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.
<!-- end patch for https://github.com/emberjs/ember.js/issues/19333 -->
195
-
196
-
197
150
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—namespaced components are not special in any way.
198
151
199
152
## Forwarding HTML Attributes with `...attributes`
@@ -239,11 +192,11 @@ Let's write a test for our new component!
239
192
240
193
-test('it renders', asyncfunction (assert) {
241
194
-// Set any properties with this.set('myProperty', 'value');
242
-
-// Handle any actions with this.set('myAction', function(val) { ... });
195
+
-// Handle any actions with this.set('myAction', function(val) { ... });
Here, in the *[component's constructor][TODO: link to component's constructor]*, we *[initialized][TODO: link to initialized]* the *[instance variable][TODO: link to instance variable]*`this.isLarge` with the value `false`, since this is the default state that we want for our component.
Here, we import the access token from the config file and return it from a `token`*[getter](https://javascript.info/property-accessors)*. This allows us to access our token as `this.token` both inside the `MapComponent` class body, as well as the component's template. It is also important to [URL-encode](https://javascript.info/url#encoding-strings) the token, just in case it contains any special characters that are not URL-safe.
@@ -193,7 +171,7 @@ We just added a lot of behavior into a single component, so let's write some tes
193
171
194
172
-test('it renders', asyncfunction (assert) {
195
173
-// Set any properties with this.set('myProperty', 'value');
196
-
-// Handle any actions with this.set('myAction', function(val) { ... });
174
+
-// Handle any actions with this.set('myAction', function(val) { ... });
197
175
+test('it renders a map image for the specified parameters', asyncfunction (assert) {
198
176
+awaitrender(hbs`<Map
199
177
+ @lat="37.7797"
@@ -212,7 +190,7 @@ We just added a lot of behavior into a single component, so let's write some tes
0 commit comments