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

Update step_03.ngdoc #7815

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions docs/content/tutorial/step_03.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,39 @@ Display the current value of the `query` model by adding a `{{query}}` binding i
### Display Query in Title
Let's see how we can get the current value of the `query` model to appear in the HTML page title.

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

```js
it('should display the current filter value in the title bar', function() {

expect(browser.getTitle()).toMatch(/Google Phone Gallery:\s*$/);

element(by.model('query')).sendKeys('nexus');

expect(browser.getTitle()).toMatch(/Google Phone Gallery: nexus$/);
describe('PhoneCat App', function() {

describe('Phone list view', function() {

beforeEach(function() {
browser.get('app/index.html');
});

var phoneList = element.all(by.repeater('phone in phones'));
var query = element(by.model('query'));

it('should filter the phone list as user types into the search box', function() {
expect(phoneList.count()).toBe(3);

query.sendKeys('nexus');
expect(phoneList.count()).toBe(1);

query.clear();
query.sendKeys('motorola');
expect(phoneList.count()).toBe(2);
});

it('should display the current filter value in the title bar', function() {
query.clear();
expect(browser.getTitle()).toMatch(/Google Phone Gallery:\s*$/);

query.sendKeys('nexus');
expect(browser.getTitle()).toMatch(/Google Phone Gallery: nexus$/);
});
});
});
```

Expand Down