You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,13 +24,16 @@ once the user started fixing the problem?
24
24
Just like our nice HTML5 validation errors do?
25
25
For that we'd need a teeny-tiny bit of JavaScript.
26
26
27
+
28
+
// RITA: In this paragraph, please tell us how we're going to play around with JavaScript and what it'll teach us. I mean, you're going to use Javascript to make it so the duplicate item error message disappears once the user fixes the problem.
27
29
Python is a delightful language to program in.
28
30
JavaScript wasn't always that.
29
31
But many of the rough edges have been smoothed off,
30
-
and I think it's fair to say that it's actually quite nice now.
31
-
And in the world of web development, it's unavoidable.
32
+
and I think it's fair to say that JavaScript is actually quite nice now.
33
+
And in the world of web development, using JavaScript is unavoidable.
32
34
So let's dip our toes in, and see if we can't have a bit of fun.
33
35
36
+
// RITA: Consider dropping mention of JavaScript: The Good Parts and just referencing your more recent recommendations. If you've read Eloquent JavaScript, consider dropping "I've heard good things" to make your recommendation sound more confident. I suppose you could still mention JavaScript: The Good Parts after that.
34
37
NOTE: I'm going to assume you know the basics of JavaScript syntax.
35
38
If not, I used to recommend https://amzn.to/3UXVUKd[JavaScript: The Good Parts],
36
39
which was the best guide, once upon a time.
@@ -46,6 +49,8 @@ NOTE: I'm going to assume you know the basics of JavaScript syntax.
// RITA: In this first paragraph, please tell us WHY we're adding a new FT. How does this relate to making it so the duplicate item error messages disappear once the user fixes the problem? Give us context.
49
54
Let's add a new functional test to the `ItemValidationTest` class:
// RITA: In this paragraph, please tell us how this relates to the goal of the example in this chapter. How does this help the goal of this chapter, which is to get rid of the duplicate item error messages as they are resolved?
772
785
One of the difficulties with JavaScript in general, and testing in particular,
773
786
is in understanding the order of execution of our code (i.e., what happens when).
774
787
When does our code in _lists.js_ run, and when does each of our tests run? And
@@ -901,7 +914,7 @@ And in our tests file, we call `initialize()` in our key test:
901
914
});
902
915
----
903
916
====
904
-
917
+
//RITA: What does "here" refer to?
905
918
<1> Here. We don't need to call it in our sense-check.
906
919
907
920
@@ -918,7 +931,7 @@ Superlists tests
918
931
* error message should be hidden on input
919
932
* sense-check our html fixture
920
933
----
921
-
934
+
// RITA: Why does it make more sense now?
922
935
And now the `console.log` outputs should make more sense:
923
936
924
937
[role="skipme"]
@@ -934,9 +947,10 @@ initialize called lists.js:3:11
934
947
=== Deliberately Breaking Our Code to Force Ourselves To Write More Tests
935
948
936
949
I'm always nervous when I see green tests.
937
-
We've copy-pasted 5 lines of code from our spike with just one test?
950
+
We've copy-pasted five lines of code from our spike with just one test.
938
951
That was a little too easy, even despite that little `initialize()` dance.
939
952
953
+
// RITA: Why do we want to try to deliberately break the initialize function? Give us context.
940
954
Let's change our `initialize()` function to deliberately break it.
941
955
What if we just immediately hide errors?
942
956
@@ -1041,6 +1055,7 @@ so that they're defined in the same file that actually has the HTML elements.
1041
1055
1042
1056
And while we're at it, our tests could do with a bit of refactoring too!
1043
1057
1058
+
// RITA: Please tell us the goal of the following code block.
1044
1059
1045
1060
[role="sourcecode"]
1046
1061
.src/lists/static/tests/Spec.js (ch16l022)
@@ -1256,7 +1271,7 @@ Expected true to be false.
1256
1271
<Jasmine>
1257
1272
----
1258
1273
1259
-
Ok, back to the right way around:
1274
+
OK, back to the right way around:
1260
1275
1261
1276
[role="sourcecode"]
1262
1277
.src/lists/static/lists.js (ch16l027)
@@ -1334,6 +1349,7 @@ NOTE: We're using `<script>` tag to import our code,
1334
1349
As the tests flashed past, you may have noticed an unsatisfactory bit of red,
1335
1350
still left around our input box.
1336
1351
1352
+
// RITA: Please make sure to conclude this in the spike section so that you can call back to it here.
1337
1353
Wait a minute! We forgot one of the key things we learned in our spike!
1338
1354
We don't need to manually hack `style.display=none`,
1339
1355
we can work _with_ the Boostrap framework,
@@ -1484,7 +1500,7 @@ And the base template, yay. Nothing more satisfying than _deleting code_:
1484
1500
----
1485
1501
====
1486
1502
1487
-
1503
+
// RITA: Are we missing code here?
1488
1504
And we can run the FT one more time, just for safety:
1489
1505
1490
1506
@@ -1497,13 +1513,13 @@ And we can run the FT one more time, just for safety:
1497
1513
1498
1514
[[columbo-onload]]
1499
1515
=== Columbo Says: wait for Onload
1500
-
1501
-
[quote, Columbo]
1516
+
// RITA: We need a descriptor to give Columbo context.
// RITA: It might be nice to add something to the effect of "before we continue, it's good to do one more thing" so that it ties in with the Columbo quote.
1507
1523
Finally, whenever you have some JavaScript that interacts with the DOM,
1508
1524
it's always good to wrap it in some "onload" boilerplate
1509
1525
to make sure that the page has fully loaded before it tries to do anything.
@@ -1525,7 +1541,7 @@ The modern js onload boilerplate is minimal
1525
1541
</script>
1526
1542
----
1527
1543
====
1528
-
1544
+
// RITA: Please embed URLs to descriptive text. Also, this link didn't work for me. Please check.
0 commit comments