on xenial help sign in
Make all tests pass again
10113e9Mirco Müller
Notifications/Notification.qml+9−3
@@ -41,13 +41,16 @@ UbuntuShape {
41
41
42 Repeater {
42 Repeater {
43 id: actionRepeater
43 id: actionRepeater
44− model: actions
44+ model: notification.actions
45 }
45 }
46
46
47 anchors.fill: contentColumn
47 anchors.fill: contentColumn
48 objectName: "interactiveArea"
48 objectName: "interactiveArea"
49 enabled: notification.type == Notification.Interactive
49 enabled: notification.type == Notification.Interactive
50+ onClicked: {
50− onClicked: notification.notification.invokeAction(actionRepeater.model.actionId(0))
51+ notification.notification.invokeAction(actionRepeater.model.get(0).id)
52+ actionInvoked(actionRepeater.model.get(0).id)
53+ }
51 }
54 }
52
55
53 Column {
56 Column {
@@ -153,7 +156,10 @@ UbuntuShape {
153 width: (buttonRow.width - buttonRow.spacing) / 2
156 width: (buttonRow.width - buttonRow.spacing) / 2
154 height: units.gu(4)
157 height: units.gu(4)
155 text: label
158 text: label
159+ onClicked: {
156− onClicked: notification.notification.invokeAction(id)
160+ notification.notification.invokeAction(id)
161+ actionInvoked(id)
162+ }
157 }
163 }
158 }
164 }
159 }
165 }
Notifications/Notifications.qml+1−1
@@ -39,7 +39,7 @@ ListView {
39 body: model.body
39 body: model.body
40 actions: model.actions
40 actions: model.actions
41 notificationId: model.id
41 notificationId: model.id
42− notification: notificationList.model.get(notificationId)
42+ notification: notificationList.model.getRaw(notificationId)
43 }
43 }
44
44
45 populate: Transition {
45 populate: Transition {
tests/qmltests/Notifications/tst_Notifications.qml+17
@@ -25,8 +25,25 @@ import Unity.Notifications 1.0
25Row {
25Row {
26 id: rootRow
26 id: rootRow
27
27
28+ Component {
29+ id: mockNotification
30+
31+ QtObject {
32+
33+ signal actionInvoked()
34+
35+ function invokeAction(actionId) {
36+ actionInvoked()
37+ }
38+ }
39+ }
40+
28 ListModel {
41 ListModel {
29 id: mockModel
42 id: mockModel
43+
44+ function getRaw(id) {
45+ return mockNotification.createObject(mockModel)
46+ }
30 }
47 }
31
48
32 function addSnapDecisionNotification() {
49 function addSnapDecisionNotification() {