thamara / time-to-leave

Log work hours and get notified when it's time to leave the office and start to live.
http://timetoleave.app
GNU General Public License v3.0
463 stars 271 forks source link

Reset preferences feature with button and reset functionality and cor… #916

Closed sisir-umich closed 1 year ago

sisir-umich commented 1 year ago

…responding UI test

Related issue

Closes #891

Context / Background

It was recently requested that a feature to reset preferences to their default values would be useful, so this implements that functionality.

What change is being introduced by this PR?

This PR is to review a "Reset" button in the preferences window that returns the preferences to their default values. To indicate that the reset occurred, the button's text changes to "Resetted!" (Attached are screenshots of this functionality). Upon closing the Preferences window, the preferences return to default in the main TTL window. To accomplish this, I added a new button to the src/preferences.html file with styling in the css/styles.css file. The corresponding functionality is implemented in the resetPreferences() method in src/preferences.js. Since it was difficult to update the preferences within the window as soon as the button is pressed and to create a pop-up, the text change on the button can indicate to the user that their action was successful. However, this is a rudimentary solution, and changes can be made by modifying the resetPreferences() method.

Screen Shot 2022-12-02 at 7 52 19 PM Screen Shot 2022-12-02 at 7 52 30 PM

How will this be tested?

There has been a unit test added that performs a click on the new button using Jquery, and the corresponding text change verifies that the button responds to the click. Underlying preferences changes can be verified by running the applications, changing some preferences, pressing "Reset", and seeing if the changes occur.


sisir-umich commented 1 year ago

I apologize - some of the changes in this have code reversions. I'm closing this PR and will submit a new one.