Skip to content

Commit f92ea47

Browse files
committed
small things in 16
1 parent de0ca14 commit f92ea47

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

chapter_16_javascript.asciidoc

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ at the bottom of our _base.html_ template:
240240

241241
<4> It finds the error message element,
242242
and then hides it by setting its `style.display` to "none".
243-
243+
244244
That's actually good enough to get our FT passing:
245245

246246
[subs="specialcharacters,quotes"]
@@ -499,12 +499,13 @@ image::images/jasmine-in-browser-red.png["Jasmine browser-based spec runner show
499499

500500
.Is the Jasmine Standalone Browser Test Runner Unconventional?
501501
*******************************************************************************
502-
In all honesty, I'm not sure. The JavaScript world moves so fast that
503-
even if I was sure when I wrote it, I'd be wrong by the time you read this.
502+
I think it probably is, to be honest.
503+
Although the JavaScript world moves so fast,
504+
I could be wrong by the time you read this.
504505
505506
What I do know is that, along with moving very fast,
506507
JavaScript things can very quickly become very complicated.
507-
A lot of people are working with frameworks these days (React is the main one),
508+
A lot of people are working with frameworks these days (React is the main one),
508509
and along with that comes TypeScript, transpilers, to say nothing of Node.js,
509510
`npm`, the `node_modules` folder, and a very steep learning curve.
510511
@@ -516,7 +517,8 @@ and it lets us tests interactions with the DOM.
516517
That's enough to give us a basic environment in which to do TDD in JavaScript.
517518
518519
If you decide to go further in the world of frontend,
519-
you probably will eventually get into the complexity of frameworks and transpilers,
520+
you probably will eventually get into the complexity of frameworks
521+
and TypeScript and transpilers,
520522
but the basics we work with here will still be a good foundation.
521523
522524
If you want to take a small step further,
@@ -636,6 +638,7 @@ on-failure messages into individual `expect/toBe` expressions.
636638
If you refresh the browser, you should see that all passes:
637639

638640

641+
[[first-jasmine-output]]
639642
.Expected results from Jasmine in the browser
640643
====
641644
[role="jasmine-output"]
@@ -650,7 +653,8 @@ Superlists tests
650653
----
651654
====
652655

653-
(I'll show the Jasmine outputs as text, like the above, from now on,
656+
657+
(I'll show the Jasmine outputs as text, as in <<first-jasmine-output>>, from now on,
654658
to avoid filling the chapter with screenshots.)
655659

656660

@@ -725,7 +729,7 @@ into _lists.js_:
725729
[role="sourcecode"]
726730
.src/lists/static/lists.js (ch16l014)
727731
====
728-
[source,html]
732+
[source,javascript]
729733
----
730734
const textInput = document.querySelector("#id_text");
731735
textInput.oninput = () => {
@@ -780,7 +784,7 @@ Let's add a couple of debug prints, or "console.logs":
780784
[role="sourcecode"]
781785
.src/lists/static/tests/Spec.js (ch16l015)
782786
====
783-
[source,html]
787+
[source,javascript]
784788
----
785789
console.log("Spec.js loading");
786790
@@ -838,7 +842,8 @@ What do we see?
838842
* then we see a `beforeEach`, which is when our test fixture actually gets added to the DOM
839843
* then we see the first test run.
840844

841-
This explains the problem - when _lists.js_, the input node doesn't exist yet.
845+
This explains the problem - when _lists.js_ loads,
846+
the input node doesn't exist yet.
842847

843848

844849

@@ -1090,7 +1095,7 @@ describe("Superlists tests", () => {
10901095
<5> Here's why `textInput` and `errorMsg` can't be constants:
10911096
we're re-creating the DOM fixture in every `beforeEach`,
10921097
so we need to re-fetch the elements each time.
1093-
1098+
10941099

10951100
Now we can apply some DRY to strip down our tests:
10961101

@@ -1099,7 +1104,7 @@ Now we can apply some DRY to strip down our tests:
10991104
[role="sourcecode"]
11001105
.src/lists/static/tests/Spec.js (ch16l023)
11011106
====
1102-
[source,python]
1107+
[source,javascript]
11031108
----
11041109
it("sense-check our html fixture", () => {
11051110
expect(errorMsg.checkVisibility()).toBe(true);
@@ -1235,7 +1240,7 @@ const initialize = (errorSelector, inputSelector) => {
12351240
----
12361241
====
12371242

1238-
Phew, that gives us a failure:
1243+
Phew, that does indeed fail:
12391244

12401245
[role="jasmine-output"]
12411246
[subs="specialcharacters,quotes"]
@@ -1409,7 +1414,8 @@ Superlists tests
14091414
----
14101415

14111416

1412-
Let's do a little more refactoring. If your editor is set up to do some JavaScript linting,
1417+
Let's do a little more refactoring.
1418+
If your editor is set up to do some JavaScript linting,
14131419
you might have seen a warning saying:
14141420

14151421

@@ -1490,7 +1496,7 @@ And we can run the FT one more time, just for safety:
14901496

14911497

14921498
[[columbo-onload]]
1493-
=== Columbo Says: wait for Onload
1499+
=== Columbo Says: wait for Onload
14941500

14951501
[quote, Columbo]
14961502
______________________________________________________________

0 commit comments

Comments
 (0)