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:

committed by
Alex Rickabaugh

parent
3012a8e71c
commit
fc709423f2
@ -3,25 +3,25 @@ import { browser, element, by } from 'protractor';
|
||||
// Angular E2E Testing Guide:
|
||||
// https://docs.angularjs.org/guide/e2e-testing
|
||||
|
||||
describe('PhoneCat Application', function() {
|
||||
describe('PhoneCat Application', () => {
|
||||
|
||||
// #docregion redirect
|
||||
it('should redirect `index.html` to `index.html#!/phones', function() {
|
||||
it('should redirect `index.html` to `index.html#!/phones', () => {
|
||||
browser.get('index.html');
|
||||
browser.waitForAngular();
|
||||
browser.getCurrentUrl().then(function(url: string) {
|
||||
browser.getCurrentUrl().then((url: string) => {
|
||||
expect(url.endsWith('/phones')).toBe(true);
|
||||
});
|
||||
});
|
||||
// #enddocregion redirect
|
||||
|
||||
describe('View: Phone list', function() {
|
||||
describe('View: Phone list', () => {
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
browser.get('index.html#!/phones');
|
||||
});
|
||||
|
||||
it('should filter the phone list as a user types into the search box', function() {
|
||||
it('should filter the phone list as a user types into the search box', () => {
|
||||
let phoneList = element.all(by.css('.phones li'));
|
||||
let query = element(by.css('input'));
|
||||
|
||||
@ -35,16 +35,14 @@ describe('PhoneCat Application', function() {
|
||||
expect(phoneList.count()).toBe(8);
|
||||
});
|
||||
|
||||
it('should be possible to control phone order via the drop-down menu', function() {
|
||||
it('should be possible to control phone order via the drop-down menu', () => {
|
||||
let queryField = element(by.css('input'));
|
||||
let orderSelect = element(by.css('select'));
|
||||
let nameOption = orderSelect.element(by.css('option[value="name"]'));
|
||||
let phoneNameColumn = element.all(by.css('.phones .name'));
|
||||
|
||||
function getNames() {
|
||||
return phoneNameColumn.map(function(elem) {
|
||||
return elem.getText();
|
||||
});
|
||||
return phoneNameColumn.map((elem) => elem.getText());
|
||||
}
|
||||
|
||||
queryField.sendKeys('tablet'); // Let's narrow the dataset to make the assertions shorter
|
||||
@ -63,11 +61,11 @@ describe('PhoneCat Application', function() {
|
||||
});
|
||||
|
||||
// #docregion links
|
||||
it('should render phone specific links', function() {
|
||||
it('should render phone specific links', () => {
|
||||
let query = element(by.css('input'));
|
||||
query.sendKeys('nexus');
|
||||
element.all(by.css('.phones li a')).first().click();
|
||||
browser.getCurrentUrl().then(function(url: string) {
|
||||
browser.getCurrentUrl().then((url: string) => {
|
||||
expect(url.endsWith('/phones/nexus-s')).toBe(true);
|
||||
});
|
||||
});
|
||||
@ -75,23 +73,23 @@ describe('PhoneCat Application', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('View: Phone detail', function() {
|
||||
describe('View: Phone detail', () => {
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(() => {
|
||||
browser.get('index.html#!/phones/nexus-s');
|
||||
});
|
||||
|
||||
it('should display the `nexus-s` page', function() {
|
||||
it('should display the `nexus-s` page', () => {
|
||||
expect(element(by.css('h1')).getText()).toBe('Nexus S');
|
||||
});
|
||||
|
||||
it('should display the first phone image as the main phone image', function() {
|
||||
it('should display the first phone image as the main phone image', () => {
|
||||
let mainImage = element(by.css('img.phone.selected'));
|
||||
|
||||
expect(mainImage.getAttribute('src')).toMatch(/img\/phones\/nexus-s.0.jpg/);
|
||||
});
|
||||
|
||||
it('should swap the main image when clicking on a thumbnail image', function() {
|
||||
it('should swap the main image when clicking on a thumbnail image', () => {
|
||||
let mainImage = element(by.css('img.phone.selected'));
|
||||
let thumbnails = element.all(by.css('.phone-thumbs img'));
|
||||
|
||||
|
Reference in New Issue
Block a user