Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit cd9459e

Browse files
ifalvarezIgorMinar
authored andcommitted
docs(tutorial): update step_03.ngdoc
1) The original document is not clear to a new developer in where to place the code. 2) The query.clear() statement to clear the query before the second test is missing in the original document. 3) Refactored to use the query and phoneList variables in both tests, so its easier to read and understand. Closes #7815
1 parent 2862883 commit cd9459e

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

docs/content/tutorial/step_03.ngdoc

+31-8
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,39 @@ Display the current value of the `query` model by adding a `{{query}}` binding i
145145
### Display Query in Title
146146
Let's see how we can get the current value of the `query` model to appear in the HTML page title.
147147

148-
* Add the following end-to-end test into the `describe` block within `test/e2e/scenarios.js`:
148+
* Add an end-to-end test into the `describe` block, `test/e2e/scenarios.js` should look like this:
149149

150150
```js
151-
it('should display the current filter value in the title bar', function() {
152-
153-
expect(browser.getTitle()).toMatch(/Google Phone Gallery:\s*$/);
154-
155-
element(by.model('query')).sendKeys('nexus');
156-
157-
expect(browser.getTitle()).toMatch(/Google Phone Gallery: nexus$/);
151+
describe('PhoneCat App', function() {
152+
153+
describe('Phone list view', function() {
154+
155+
beforeEach(function() {
156+
browser.get('app/index.html');
157+
});
158+
159+
var phoneList = element.all(by.repeater('phone in phones'));
160+
var query = element(by.model('query'));
161+
162+
it('should filter the phone list as user types into the search box', function() {
163+
expect(phoneList.count()).toBe(3);
164+
165+
query.sendKeys('nexus');
166+
expect(phoneList.count()).toBe(1);
167+
168+
query.clear();
169+
query.sendKeys('motorola');
170+
expect(phoneList.count()).toBe(2);
171+
});
172+
173+
it('should display the current filter value in the title bar', function() {
174+
query.clear();
175+
expect(browser.getTitle()).toMatch(/Google Phone Gallery:\s*$/);
176+
177+
query.sendKeys('nexus');
178+
expect(browser.getTitle()).toMatch(/Google Phone Gallery: nexus$/);
179+
});
180+
});
158181
});
159182
```
160183

0 commit comments

Comments
 (0)