diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-03-08 11:24:20 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-03-08 11:24:20 +0100 |
commit | fa04490373f4f09dfadfdc3450eb98a4514072e7 (patch) | |
tree | f8cdf98b76b2be78fee820eb5637273411742d5f | |
parent | 1424927cb9a0f5fe79ff5d62da1aa452601a41e9 (diff) | |
download | kube-fa04490373f4f09dfadfdc3450eb98a4514072e7.tar.gz kube-fa04490373f4f09dfadfdc3450eb98a4514072e7.zip |
Test move to trash
-rw-r--r-- | framework/qml/MailListView.qml | 1 | ||||
-rw-r--r-- | views/conversation/tests/tst_conversationview.qml | 65 |
2 files changed, 65 insertions, 1 deletions
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index cc68f003..55a3aaff 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -294,6 +294,7 @@ FocusScope { | |||
294 | 294 | ||
295 | Kube.IconButton { | 295 | Kube.IconButton { |
296 | id: deleteButton | 296 | id: deleteButton |
297 | objectName: "deleteButton" | ||
297 | iconName: Kube.Icons.moveToTrash | 298 | iconName: Kube.Icons.moveToTrash |
298 | visible: !!model.mail | 299 | visible: !!model.mail |
299 | onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) | 300 | onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) |
diff --git a/views/conversation/tests/tst_conversationview.qml b/views/conversation/tests/tst_conversationview.qml index 610c28b3..666114fd 100644 --- a/views/conversation/tests/tst_conversationview.qml +++ b/views/conversation/tests/tst_conversationview.qml | |||
@@ -115,6 +115,69 @@ TestCase { | |||
115 | verify(conversationView) | 115 | verify(conversationView) |
116 | var listView = findChild(conversationView, "listView"); | 116 | var listView = findChild(conversationView, "listView"); |
117 | verify(listView) | 117 | verify(listView) |
118 | // tryCompare(listView, "count", 2) | 118 | } |
119 | |||
120 | function test_4moveToTrash() { | ||
121 | var initialState = { | ||
122 | accounts: [{ | ||
123 | id: "account1", | ||
124 | name: "Test Account" | ||
125 | }], | ||
126 | identities: [{ | ||
127 | account: "account1", | ||
128 | name: "Test Identity", | ||
129 | address: "identity@example.org" | ||
130 | }], | ||
131 | resources: [{ | ||
132 | id: "resource1", | ||
133 | account: "account1", | ||
134 | type: "dummy" | ||
135 | }, | ||
136 | { | ||
137 | id: "resource2", | ||
138 | account: "account1", | ||
139 | type: "mailtransport" | ||
140 | }], | ||
141 | folders: [{ | ||
142 | id: "folder1", | ||
143 | resource: "resource1", | ||
144 | name: "Folder 1", | ||
145 | specialpurpose: ["inbox"], | ||
146 | mails: [{ | ||
147 | resource: "resource1", | ||
148 | subject: "subject1", | ||
149 | body: "body", | ||
150 | to: ["to@example.org"], | ||
151 | cc: ["cc@example.org"], | ||
152 | bcc: ["bcc@example.org"] | ||
153 | } | ||
154 | ], | ||
155 | }], | ||
156 | } | ||
157 | TestStore.setup(initialState) | ||
158 | var mailView = createTemporaryObject(mailViewComponent, testCase, {}) | ||
159 | var folderListView = findChild(mailView, "folderListView"); | ||
160 | verify(folderListView) | ||
161 | |||
162 | var folder = TestStore.load("folder", {resource: "resource1"}) | ||
163 | verify(folder) | ||
164 | |||
165 | Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": folder, "trash": false}); | ||
166 | |||
167 | var mailListView = findChild(mailView, "mailListView"); | ||
168 | verify(mailListView) | ||
169 | var listView = findChild(mailListView, "listView"); | ||
170 | verify(listView) | ||
171 | tryCompare(listView, "count", 1) | ||
172 | |||
173 | listView.currentIndex = 0 | ||
174 | var currentItem = listView.currentItem | ||
175 | verify(currentItem) | ||
176 | |||
177 | var deleteButton = findChild(currentItem, "deleteButton"); | ||
178 | verify(deleteButton) | ||
179 | deleteButton.clicked() | ||
180 | |||
181 | tryCompare(listView, "count", 0) | ||
119 | } | 182 | } |
120 | } | 183 | } |