refactor(docs-infra): fix docs examples for tslint rule only-arrow-functions (#38143)

This commit updates the docs examples to be compatible with the
`only-arrow-functions` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas
2020-07-30 13:03:13 +03:00
committed by Alex Rickabaugh
parent 3012a8e71c
commit fc709423f2
64 changed files with 486 additions and 504 deletions

View File

@ -1,57 +1,57 @@
import { browser, element, by } from 'protractor';
describe('Forms Tests', function () {
describe('Forms Tests', () => {
beforeEach(function () {
beforeEach(() => {
browser.get('');
});
it('should display correct title', function () {
it('should display correct title', () => {
expect(element.all(by.css('h1')).get(0).getText()).toEqual('Hero Form');
});
it('should not display message before submit', function () {
it('should not display message before submit', () => {
let ele = element(by.css('h2'));
expect(ele.isDisplayed()).toBe(false);
});
it('should hide form after submit', function () {
it('should hide form after submit', () => {
let ele = element.all(by.css('h1')).get(0);
expect(ele.isDisplayed()).toBe(true);
let b = element.all(by.css('button[type=submit]')).get(0);
b.click().then(function() {
b.click().then(() => {
expect(ele.isDisplayed()).toBe(false);
});
});
it('should display message after submit', function () {
it('should display message after submit', () => {
let b = element.all(by.css('button[type=submit]')).get(0);
b.click().then(function() {
b.click().then(() => {
expect(element(by.css('h2')).getText()).toContain('You submitted the following');
});
});
it('should hide form after submit', function () {
it('should hide form after submit', () => {
let alterEgoEle = element.all(by.css('input[name=alterEgo]')).get(0);
expect(alterEgoEle.isDisplayed()).toBe(true);
let submitButtonEle = element.all(by.css('button[type=submit]')).get(0);
submitButtonEle.click().then(function() {
submitButtonEle.click().then(() => {
expect(alterEgoEle.isDisplayed()).toBe(false);
});
});
it('should reflect submitted data after submit', function () {
it('should reflect submitted data after submit', () => {
let test = 'testing 1 2 3';
let newValue: string;
let alterEgoEle = element.all(by.css('input[name=alterEgo]')).get(0);
alterEgoEle.getAttribute('value').then(function(value: string) {
alterEgoEle.getAttribute('value').then((value: string) => {
alterEgoEle.sendKeys(test);
newValue = value + test;
expect(alterEgoEle.getAttribute('value')).toEqual(newValue);
let b = element.all(by.css('button[type=submit]')).get(0);
return b.click();
}).then(function() {
}).then(() => {
let alterEgoTextEle = element(by.cssContainingText('div', 'Alter Ego'));
expect(alterEgoTextEle.isPresent()).toBe(true, 'cannot locate "Alter Ego" label');
let divEle = element(by.cssContainingText('div', newValue));