cherdt / BingoCardGenerator

A bingo card generator
21 stars 10 forks source link

Remove trailing and leading newlines from wordlist #26

Open dgmstuart opened 4 years ago

dgmstuart commented 4 years ago

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).

cherdt commented 4 years ago

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

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 commented 4 years ago

Good motivations both. 

Regarding offline usage, since the JavaScript file is referenced with a relative path, it’s still usable locally (if you were to move away from JQuery).

From what I’ve read, isolating the JavaScript is a prerequisite for running QUnit tests on it, but another approach could be to use an end-to-end  testing framework like Cypress.

Another alternative would be to have the source code in separate files and use some kind of framework which compiles everything down to a single HTML file.

Thanks for engaging with this: very much appreciated. 

Duncan Stuart

On Tue, 26 May 2020 at 02:16 Chris Herdt < Chris Herdt ( Chris Herdt notifications@github.com ) > wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub ( https://github.com/cherdt/BingoCardGenerator/pull/26#issuecomment-633749611 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAC77T6SKVC2GHNHUVIYJHDRTMC53ANCNFSM4NIVGXHQ ).