Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove trailing and leading newlines from wordlist #26

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dgmstuart
Copy link
Contributor

For long word lists it's useful to be able to break the list up into sub-sections with line breaks.

Previously if there was a line break before or after a word, this would be rendered in the bingo card (see image).

This change preserves internal line breaks, but removes leading and trailing breaks.

Please see the individual commit messages for a description of each step.

Screenshot 2020-05-24 at 02 26 31

In order to test this with Quinit it was necessary to extract the javascript out into its own .js file. I'm happy to split this PR into two if that makes things easier? (one for the test setup, one for the change).

- Replace tabs with spaces
- Add missing semicolons (prompted by linter)
This gives more useful failure messages
A mixture of tabs and spaces were used: this standardises on spaces
The goal here is to have the tests be able to test the javascript code
which is used in the page.

In order to do that we need to extract the javascript out to a separate
file so that the the QUnit tests can test it.

This approach follows the advice in the qunit docs:
https://qunitjs.com/intro/#make-things-testable

...but modified to allow running via the command line (and therefore on
Travis) by following this stackoverflow post:
https://stackoverflow.com/a/51861149
We need to make the behaviour here slightly more complicated, so let's
first isolate it and cover it with tests.
For long word lists it's useful to be able to break the list up into
sub-sections with line breaks.

Previously if there was a line break before or after a word, this would
be rendered in the bingo card.

This change preserves internal line breaks, but removes leading and
trailing breaks.

Note that this handles multiple line breaks in a row.
@cherdt
Copy link
Owner

cherdt commented May 26, 2020

There were originally 2 reasons why I combined the HTML, CSS, and JS into the index file:

  • Reduce requests to the server
  • To facilitate offline use of the page

It's been using jQuery for pieces for quite some time now, so the latter may not be as important (or it means I should work to eliminate jQuery).

I agree that moving it to a separate file helps facilitate testing. I'll think about this a bit.

@dgmstuart
Copy link
Contributor Author

dgmstuart commented May 26, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants