@@ -15,8 +15,8 @@ func TestIntialiseHistoryWithExistingValue(t *testing.T) {
h := InitialiseHistory("This is existing content in the input field", fakeHistory)
- assert.Equal(t, h.ExistingValue(), "This is existing content in the input field")
- assert.Equal(t, h.Value(), "This is existing content in the input field")
+ assert.Equal(t, "This is existing content in the input field", h.ExistingValue())
+ assert.Equal(t, "This is existing content in the input field", h.Value())
}
func TestIntialiseHistoryScrollUp(t *testing.T) {
@@ -27,13 +27,59 @@ func TestIntialiseHistoryScrollUp(t *testing.T) {
}
h := InitialiseHistory("This is existing content in the input field", fakeHistory)
- assert.Equal(t, h.ExistingValue(), "This is existing content in the input field")
- assert.Equal(t, h.Value(), "This is existing content in the input field")
+ assert.Equal(t, "This is existing content in the input field", h.ExistingValue())
+ assert.Equal(t, "This is existing content in the input field", h.Value())
h.ScrollUp()
- assert.Equal(t, h.Value(), "3. This is the third message")
+ assert.Equal(t, "3. This is the third message", h.Value())
h.ScrollUp()
- assert.Equal(t, h.Value(), "2. This is the second message")
+ assert.Equal(t, "2. This is the second message", h.Value())
h.ScrollUp()
- assert.Equal(t, h.Value(), "1. This is the first message")
+ assert.Equal(t, "1. This is the first message", h.Value())
+}
+
+func TestIntialiseHistoryScrollDown(t *testing.T) {
+ fakeHistory := []string{
+ "1. This is the first message",
+ "2. This is the second message",
+ "3. This is the third message",
+ }
+
+ h := InitialiseHistory("This is existing content in the input field", fakeHistory)
+ assert.Equal(t, "This is existing content in the input field", h.ExistingValue())
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+}
+
+func TestIntialiseHistoryScrollUpThenDown(t *testing.T) {
+ fakeHistory := []string{
+ "1. This is the first message",
+ "2. This is the second message",
+ "3. This is the third message",
+ }
+
+ h := InitialiseHistory("This is existing content in the input field", fakeHistory)
+ assert.Equal(t, "This is existing content in the input field", h.ExistingValue())
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+
+ h.ScrollUp()
+ assert.Equal(t, "3. This is the third message", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+ h.ScrollUp()
+ assert.Equal(t, "3. This is the third message", h.Value())
+ h.ScrollUp()
+ assert.Equal(t, "2. This is the second message", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "3. This is the third message", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
+ h.ScrollDown()
+ assert.Equal(t, "This is existing content in the input field", h.Value())
}