gundb / gatling

Chat system based on GUN
19 stars 7 forks source link

Change event handler, isolate username logic, clean and dry code, pass all tests. #16

Closed PsychoLlama closed 8 years ago

PsychoLlama commented 8 years ago

The blur event is only triggered when focus is taken from the element, and since the e2e tests weren't moving the mouse away, the username was never persisted. Now, the change event is used instead, allowing the tests to progress further. The tests also seemed to be concatenating the input value, rather than replacing it. They now start by clearing the value first.

Since jQuery isn't used by mocha, it was throwing a nasty error. For the modularity of the code and reliability of the tests, all username logic has been moved into the username.js file inside www/.

Nightwatch's tests were repetitive with the username logic. The selector has been bumped up to a parent scope to reduce repetition. The code is also beautified a bit.

Mocha and Nightwatch tests are passing.