angular/aio/content/examples/template-reference-variables/e2e/src/app.e2e-spec.ts
Andrew Scott d04b550f2e docs: Deprecate longhand binding prefixes (#43671)
DEPRECATION:

The template prefixes `bind-`, `on-`, `bindon-`, and `ref-` have been deprecated
in v13. Templates should use the more widely documented syntaxes for binding and references:

* `[input]="value"` instead of `bind-input="value"`
* `[@trigger]="value"` instead of `bind-animate-trigger="value"`
* `(click)="onClick()"` instead of `on-click="onClick()"`
* `[(ngModel)]="value"` instead of `bindon-ngModel="value"`
* `#templateRef` instead of `ref-templateRef`

PR Close #43671
2021-10-04 10:27:06 -07:00

39 lines
1.3 KiB
TypeScript

import { browser, element, by, logging } from 'protractor';
describe('Template-reference-variables-example', () => {
beforeEach(() => browser.get(''));
// helper function used to test what's logged to the console
async function logChecker(contents: string) {
const logs = await browser
.manage()
.logs()
.get(logging.Type.BROWSER);
const messages = logs.filter(({ message }) => message.indexOf(contents) !== -1);
expect(messages.length).toBeGreaterThan(0);
}
it('should display Template reference variables', async () => {
expect(await element(by.css('h1')).getText()).toEqual(
'Template reference variables'
);
});
it('should log a Calling 123 ... message', async () => {
const callButton = element.all(by.css('button')).get(0);
const phoneInput = element.all(by.css('input')).get(0);
await phoneInput.sendKeys('123');
await callButton.click();
const contents = 'Calling 123 ...';
await logChecker(contents);
});
it('should submit form', async () => {
const submitButton = element.all(by.css('button')).get(2);
const nameInput = element.all(by.css('input')).get(1);
await nameInput.sendKeys('123');
await submitButton.click();
expect(await element.all(by.css('div > p')).get(2).getText()).toEqual('Submitted. Form value is {"name":"123"}');
});
});