├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mastering React Test-Driven Development 2 | Published by Packt 3 | 4 | This is companion repository for the book _Mastering React Test-Driven Development_ by Daniel Irvine, published by Packt. 5 | 6 | The repository contains two branches, both of which are their own independent projects with their own READMEs. If you're interested in the contents of the books you can take a look at them now: 7 | 8 | * [Appointments](https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development/tree/appointments/appointments), a hair salon booking system 9 | * [Spec Logo](https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development/tree/spec-logo/spec-logo]), an online Logo environment for building Logo scripts 10 | 11 | The book itself has checkpoints that are based on various tags. If you're following along then you'll need to be comfortable switching tags. 12 | 13 | ## Working along with the book 14 | 15 | You should fork and then clone this repo to your local machine, and then check out a tag: 16 | 17 | git checkout tags/starting-point 18 | 19 | You should then branch from this tag before continuing with changes: 20 | 21 | git checkout -b starting-point-mine 22 | 23 | Note: If you are unable to checkout tags then it may mean tags were not fetched during fork. You can fetch these using the following commands: 24 | 25 | cd /path/to/local/repo 26 | git remote add upstream https://github.com/PacktPublishing/Mastering-React-Test-Driven-Development 27 | git fetch --tags upstream 28 | git push -f --tags origin main 29 | 30 | # Merging in changes from additional commits 31 | 32 | Not all commits are covered in the book. They have been omitted because they are repetitive and teach nothing new. These occasions are clearly marked at the start of each section. You have two choices: 33 | 34 | * You can repeat the process above, starting a new branch and 'losing' all of your previous work in favor of the book's version. Of course, you'll still have the previous branch available that you were working on, it just won't join with your new branch. 35 | * You can merge in the commits that you were missing. This may not turn out to be straightforward if your code has deviated significantly from the book's code. 36 | 37 | You can compare the difference between your current HEAD and the listed tag with `git diff`: 38 | 39 | git diff load-available-time-slots 40 | 41 | You can then manually apply those changes. 42 | 43 | If you'd rather try to automate those changes, then you can use git merge: 44 | 45 | git merge load-available-time-slots 46 | 47 | ## Errata 48 | * In _Chapter 10_, the section _‘Focusing the prompt’_ on page 349 contains a test that uses the value ```document.activeElement```. In JSDOM 15, this test will no longer function without additional configuration, which is given below. Please apply this change before proceeding with the text. In the file ```test/domManipulators.js```, change the ```createContainer``` function to read as below. The second line of the function, which calls the ```appendChild``` function on ```document.body```, is new and needs to be inserted, as shown: 49 | 50 | ``` 51 | export const createContainer = () => { 52 | const container = document.createElement('div') 53 | 54 | document.body.appendChild(container) 55 | ... remaining function body goes here ... 56 | } 57 | ``` 58 | 59 | ## Get in touch 60 | 61 | You can contact the author directly by raising Issues here in GitHub, or by contacting him on Twitter. He is [@d_ir](https://twitter.com/d_ir). 62 | --------------------------------------------------------------------------------