bloominstituteoftechnology/Precourse

Type error in Lesson8-DOM/homework/__tests__/DOM.test.js

Opened this issue · 1 comments

TypeError: Cannot set property 'value' of null

  89 | 
  90 |   it('adds a Todo to the toDoItems array', () => {
> 91 |     document.querySelector('#newTodoToAdd').value = 'Create new Todo';
  92 |     addTodo();
  93 |     expect(toDoItems.length).toBeGreaterThan(0);
  94 |   });

To be clear, this is an error in the test file, and not in the DOMhomework.js file that students work on. #newTodoToAdd was never an element that was defined and added to the DOM in the aforementioned test file, and so it never is assigned the corresponding value property.

Fixed