@@ -240,7 +240,7 @@ at the bottom of our _base.html_ template:
240
240
241
241
<4> It finds the error message element,
242
242
and then hides it by setting its `style.display` to "none".
243
-
243
+
244
244
That's actually good enough to get our FT passing:
245
245
246
246
[subs="specialcharacters,quotes"]
@@ -499,12 +499,13 @@ image::images/jasmine-in-browser-red.png["Jasmine browser-based spec runner show
499
499
500
500
.Is the Jasmine Standalone Browser Test Runner Unconventional?
501
501
*******************************************************************************
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.
504
505
505
506
What I do know is that, along with moving very fast,
506
507
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),
508
509
and along with that comes TypeScript, transpilers, to say nothing of Node.js,
509
510
`npm`, the `node_modules` folder, and a very steep learning curve.
510
511
@@ -516,7 +517,8 @@ and it lets us tests interactions with the DOM.
516
517
That's enough to give us a basic environment in which to do TDD in JavaScript.
517
518
518
519
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,
520
522
but the basics we work with here will still be a good foundation.
521
523
522
524
If you want to take a small step further,
@@ -636,6 +638,7 @@ on-failure messages into individual `expect/toBe` expressions.
636
638
If you refresh the browser, you should see that all passes:
637
639
638
640
641
+ [[first-jasmine-output]]
639
642
.Expected results from Jasmine in the browser
640
643
====
641
644
[role="jasmine-output"]
@@ -650,7 +653,8 @@ Superlists tests
650
653
----
651
654
====
652
655
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,
654
658
to avoid filling the chapter with screenshots.)
655
659
656
660
@@ -725,7 +729,7 @@ into _lists.js_:
725
729
[role="sourcecode"]
726
730
.src/lists/static/lists.js (ch16l014)
727
731
====
728
- [source,html ]
732
+ [source,javascript ]
729
733
----
730
734
const textInput = document.querySelector("#id_text");
731
735
textInput.oninput = () => {
@@ -780,7 +784,7 @@ Let's add a couple of debug prints, or "console.logs":
780
784
[role="sourcecode"]
781
785
.src/lists/static/tests/Spec.js (ch16l015)
782
786
====
783
- [source,html ]
787
+ [source,javascript ]
784
788
----
785
789
console.log("Spec.js loading");
786
790
@@ -838,7 +842,8 @@ What do we see?
838
842
* then we see a `beforeEach`, which is when our test fixture actually gets added to the DOM
839
843
* then we see the first test run.
840
844
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.
842
847
843
848
844
849
@@ -1090,7 +1095,7 @@ describe("Superlists tests", () => {
1090
1095
<5> Here's why `textInput` and `errorMsg` can't be constants:
1091
1096
we're re-creating the DOM fixture in every `beforeEach`,
1092
1097
so we need to re-fetch the elements each time.
1093
-
1098
+
1094
1099
1095
1100
Now we can apply some DRY to strip down our tests:
1096
1101
@@ -1099,7 +1104,7 @@ Now we can apply some DRY to strip down our tests:
1099
1104
[role="sourcecode"]
1100
1105
.src/lists/static/tests/Spec.js (ch16l023)
1101
1106
====
1102
- [source,python ]
1107
+ [source,javascript ]
1103
1108
----
1104
1109
it("sense-check our html fixture", () => {
1105
1110
expect(errorMsg.checkVisibility()).toBe(true);
@@ -1235,7 +1240,7 @@ const initialize = (errorSelector, inputSelector) => {
1235
1240
----
1236
1241
====
1237
1242
1238
- Phew, that gives us a failure :
1243
+ Phew, that does indeed fail :
1239
1244
1240
1245
[role="jasmine-output"]
1241
1246
[subs="specialcharacters,quotes"]
@@ -1409,7 +1414,8 @@ Superlists tests
1409
1414
----
1410
1415
1411
1416
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,
1413
1419
you might have seen a warning saying:
1414
1420
1415
1421
@@ -1490,7 +1496,7 @@ And we can run the FT one more time, just for safety:
1490
1496
1491
1497
1492
1498
[[columbo-onload]]
1493
- === Columbo Says: wait for Onload
1499
+ === Columbo Says: wait for Onload
1494
1500
1495
1501
[quote, Columbo]
1496
1502
______________________________________________________________
0 commit comments