Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(attribute-directives): copyedits + fix e2e warning #3330

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion public/docs/_examples/attribute-directives/e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Attribute directives', function () {
});

it('should be able to select green highlight', function () {
let highlightedEle = element(by.cssContainingText('p', 'Highlight me'));
let highlightedEle = element(by.cssContainingText('p', 'Highlight me!'));
let lightGreen = 'rgba(144, 238, 144, 1)';

expect(highlightedEle.getCssValue('background-color')).not.toEqual(lightGreen);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
<h1>My First Attribute Directive</h1>
<!-- #docregion applied -->
<p myHighlight>Highlight me!</p>
<!-- #enddocregion applied -->
<!-- #enddocregion -->
<!-- #enddocregion applied, -->

<!-- #docregion color-1 -->
<p myHighlight highlightColor="yellow">Highlighted in yellow</p>
<p myHighlight [highlightColor]="'orange'">Highlighted in orange</p>

<!-- #enddocregion color-1 -->

<!-- #docregion color-2 -->
<p myHighlight [highlightColor]="color">Highlighted with parent component's color</p>
<!-- #enddocregion color-2 -->

<!-- #docregion p-style-background -->
<p [style.background]="'lime'">I am green with envy!</p>
<!-- #enddocregion p-style-background -->
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ import { Component } from '@angular/core';
export class AppComponent {
color = 'yellow';
}
// #enddocregion class
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- #docregion -->
<!-- #docregion v2 -->
<!-- #docregion v2, -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that you can combine named and the unnamed region in a single line like this. I'm not sure that it helps the reader. Those trailing commas are hard to pick up. But let's forge ahead with this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll refrain from combining them in the future (I just find excessive docregion lines distracting when trying to read the source).

<h1>My First Attribute Directive</h1>

<h4>Pick a highlight color</h4>
Expand All @@ -10,15 +9,13 @@ <h4>Pick a highlight color</h4>
</div>
<!-- #docregion color -->
<p [myHighlight]="color">Highlight me!</p>
<!-- #enddocregion color -->
<!-- #enddocregion v2 -->
<!-- #enddocregion color, v2 -->

<!-- #docregion defaultColor -->
<p [myHighlight]="color" defaultColor="violet">
Highlight me too!
</p>
<!-- #enddocregion defaultColor -->
<!-- #enddocregion -->
<!-- #enddocregion defaultColor, -->

<hr>
<p><i>Mouse over the following lines to see fixed highlights</i></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ import { Component } from '@angular/core';
export class AppComponent {
color: string;
}
// #enddocregion class
// #enddocregion
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,6 @@ export class HighlightDirective {
// #docregion ctor
constructor(private el: ElementRef) { }
// #enddocregion ctor
// #enddocregion

// #docregion color
@Input() highlightColor: string;
// #enddocregion color

// #docregion color-2
@Input() myHighlight: string;
// #enddocregion color-2

// #docregion

// #docregion mouse-methods, host
@HostListener('mouseenter') onMouseEnter() {
Expand All @@ -39,7 +28,14 @@ export class HighlightDirective {
private highlight(color: string) {
this.el.nativeElement.style.backgroundColor = color;
}
// #enddocregion mouse-methods
// #enddocregion mouse-methods,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the move? Linter complains when properties follow methods. I hate that particular "rule" (what's the point?) and often disable it for a particular file but I don't see you doing that here.

Copy link
Contributor Author

@chalin chalin Mar 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file starts with

/* tslint:disable:no-unused-variable member-ordering */

and so the linter is happy (i.e., the build is green).

The move was so as to put all the extra "snippets" (not actually meant to be part of the class's default docregion), at the end.

(Btw, those two members were already "out of order". I figured that if they are going to be out-of-order, then might as well be at the end of the real class members.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k


// #docregion color
@Input() highlightColor: string;
// #enddocregion color

// #docregion color-2
@Input() myHighlight: string;
// #enddocregion color-2
}
// #enddocregion

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* tslint:disable:member-ordering */
// #docplaster
// #docregion
// #docregion imports
// #docregion imports,
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
// #enddocregion imports

Expand Down
Loading