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

docs(testing): tech edits #3269

Merged
merged 3 commits into from
Feb 20, 2017
Merged

docs(testing): tech edits #3269

merged 3 commits into from
Feb 20, 2017

Conversation

kapunahelewong
Copy link
Contributor

These are copy related tech edits.

Copy link
Contributor

@wardbell wardbell left a comment

Choose a reason for hiding this comment

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

I know this took a lot of work and you did well. Please make the changes I've noted here and then I'll be happy to merge it.

- [_triggerEventHandler_](#trigger-event-handler)
* [Test a component inside a test host component](#component-inside-test-host)
<br><br>
* [Test a routed component](#routed-component)
- [The _inject_ helper](#inject)
- [The _inject_ function](#inject)
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer

The inject helper function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -164,7 +181,7 @@ table(width="100%")
End-to-end tests explore the application _as users experience it_.
In e2e testing, one process runs the real application
and a second process runs protractor tests that simulate user behavior
and assert that the application responds in the browser as expected.
and assert that the application respond in the browser as expected.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please roll this back. "Responds" is correctly plural. It is the application that responds, not the tests. Please fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should only have an "s" in the indicative though, not in the subjunctive. The subjunctive here is required by "assert", which introduces the subordinate clause of expectation: "that the application respond" and the change of subject. It is the same construction as "She insists that he see a doctor." An alternative in English, which usually obscures the subjunctive, is "She wants him to see a doctor." If the first clause and second clause have different subjects and there is doubt, disbelief, denial, or imposition of will (under which expectation falls), the second clause must use the subjunctive. So you get things like:

Mom expects that he eat his lunch.
The law requires that the school have a reading program.

@wardbell I hope you read that in Leonard Nimoy's voice.

@@ -229,30 +246,31 @@ a#1st-karma-test
:marked
**Put spec files somewhere within the `src/app/` folder.**
The `karma.conf.js` tells karma to look for spec files there,
for reasons explained [below](#q-spec-file-location).
for reasons explained [later](#q-spec-file-location).
Copy link
Contributor

Choose a reason for hiding this comment

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

Really? "later" is better than "below". Whatever.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You made me laugh. I changed it back. Below sounds more natural and lets you know it's in the same page.

### Run karma
Compile and run it in karma from the command line with this command:
### Run with karma
Compile and run it in `karma` from the command line using the following command:
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be just karma, or maybe karma, but not karma. We're talking about the program called karma, not a class or command. Please fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thank you for the clarification.

code-example(format="." language="bash").
npm test
:marked
The command compiles the application and test code and starts karma.
The command compiles the application and test code and starts `karma`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please replace all instances of karma with karma or karma.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

tend to keep it `false`.

Calls `detectChanges` immediately which detects existing changes
and will trigger `ngOnInit` if the component has not yet been initialized.
Calls `detectChanges` immediately, which detects existing changes
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this sentence. I moved the sense of it up above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

When autodetect is true, the test fixture listens for _zone_ events and calls `detectChanges`.
You probably still have to call `fixture.detectChanges` to trigger data binding updates
when your test code modifies component property values directly.
When autodetect is `true`, the test fixture listens for _zone_ events and calls `detectChanges`.
Copy link
Contributor

Choose a reason for hiding this comment

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

When autodetect is true, the test fixture calls detectChanges immediately after creating the component. Then it listens for pertinent zone events and calls detectChanges accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -2247,21 +2344,16 @@ a(href="#top").to-top Back to top

a#setup-files
:marked
## Setup files
Many think writing tests is fun.
Copy link
Contributor

Choose a reason for hiding this comment

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

One of my favorite introductions ever. Sorry to see it go. But go it must.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed!!!

@@ -2295,7 +2387,7 @@ table(width="100%")
[SystemJS](https://github.com/systemjs/systemjs/blob/master/README.md)
loads the application and test files.
This script tells SystemJS where to find those files and how to load them.
It's the same version of `systemjs.config.js` used by Setup-based applications.
It's the same version of `systemjs.config.js` used by setup-based applications.
Copy link
Contributor

@wardbell wardbell Feb 18, 2017

Choose a reason for hiding this comment

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

It's the same version of systemjs.config.js you installed during setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

as the application source code files that they test because
- Such tests are easy to find
- You see at a glance if a part of our application lacks tests.
as the application source code files that they test because:
Copy link
Contributor

Choose a reason for hiding this comment

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

that they test:

Drop "because"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also noticed that that sentence started with "We". Fixed that, too.

@wardbell wardbell merged commit 894ff63 into angular:master Feb 20, 2017
@wardbell wardbell deleted the wong-testing branch February 20, 2017 23:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants