Commit b8218a33 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(Dialog/ConfirmDialog.spec.qml): use `SignalSpy`

parent 3a8bf11f
...@@ -11,14 +11,28 @@ TestCase { ...@@ -11,14 +11,28 @@ TestCase {
Component { Component {
id: builder id: builder
ConfirmDialog {} Item {
ConfirmDialog {
id: confirmDialog
}
SignalSpy {
id: spy
signalName: 'exitStatus'
target: confirmDialog
}
}
} }
function buildConfirmDialog () { function buildConfirmDialog () {
var dialog = builder.createObject(testCase) var container = builder.createObject(testCase)
verify(dialog) verify(container)
var dialog = container.data[0]
dialog.closing.connect(dialog.destroy.bind(dialog)) dialog.closing.connect(dialog.destroy.bind(dialog))
return dialog
return container
} }
function test_exitStatusViaButtons_data () { function test_exitStatusViaButtons_data () {
...@@ -29,22 +43,22 @@ TestCase { ...@@ -29,22 +43,22 @@ TestCase {
} }
function test_exitStatusViaButtons (data) { function test_exitStatusViaButtons (data) {
var dialog = buildConfirmDialog() var container = buildConfirmDialog()
var dialog = container.data[0]
dialog.exitStatus.connect(function (status) { var spy = container.data[1]
compare(status, data.expectedStatus)
})
mouseClick(dialog.buttons[data.button]) mouseClick(dialog.buttons[data.button])
spy.wait(100)
compare(spy.signalArguments[0][0], data.expectedStatus)
} }
function test_exitStatusViaClose () { function test_exitStatusViaClose () {
var dialog = buildConfirmDialog() var container = buildConfirmDialog()
var dialog = container.data[0]
dialog.exitStatus.connect(function (status) { var spy = container.data[1]
compare(status, 0)
})
dialog.close() dialog.close()
spy.wait(100)
compare(spy.signalArguments[0][0], 0)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment