7d252ea45b
* Refactor `TouchHandler` to handle double-tap and swipe gestures. * Renamed existing `onTouch` JavaScript methods to `onItemTouch` and added `onContentTouch` methods for swipe gesture. * Refactor double-tap. It's now a method in `TouchHandler` versus anonymous functions in `listen()` method. * Updated CSS classes. * Added `touch-action` CSS for `.entry-content`. * Renamed CSS classes for adding events in `TouchHandler`. * Updated users settings to replace checkbox for double tap with select for none, double tap, or swipe. * Added database migrations for new gesture_nav option. * Rename `users.double_tap` to `users.gesture_nav` and migrate existing user settings. * Updated translation files. (Non-English updated with Google Translate.) Resolves #1449, closes #1495
78 lines
1.8 KiB
Go
78 lines
1.8 KiB
Go
package form // import "miniflux.app/ui/form"
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestValid(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "hunter2",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
EntriesPerPage: 50,
|
|
DisplayMode: "standalone",
|
|
GestureNav: "tap",
|
|
DefaultReadingSpeed: 35,
|
|
CJKReadingSpeed: 25,
|
|
DefaultHomePage: "unread",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestConfirmationEmpty(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
EntriesPerPage: 50,
|
|
DisplayMode: "standalone",
|
|
GestureNav: "tap",
|
|
DefaultReadingSpeed: 35,
|
|
CJKReadingSpeed: 25,
|
|
DefaultHomePage: "unread",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
if settings.Password != "" {
|
|
t.Error("Password should have been cleared")
|
|
}
|
|
}
|
|
|
|
func TestConfirmationIncorrect(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "unter2",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
EntriesPerPage: 50,
|
|
DisplayMode: "standalone",
|
|
GestureNav: "tap",
|
|
DefaultReadingSpeed: 35,
|
|
CJKReadingSpeed: 25,
|
|
DefaultHomePage: "unread",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err == nil {
|
|
t.Error("Validate should return an error")
|
|
}
|
|
}
|