From 872093116f2b8cee869f38cdccf527b22d1f1ea1 Mon Sep 17 00:00:00 2001
From: Ronan Abhamon <ronan.abhamon@belledonne-communications.com>
Date: Fri, 15 Jun 2018 15:20:35 +0200
Subject: [PATCH] fix(ExclusiveButtons.spec.qml): do not use SignalSpy in Qt
 5.11, click is emitted twice instead of one

---
 .../Form/Buttons/ExclusiveButtons.spec.qml    | 28 ++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml b/ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
index be92a1c4..0154fa95 100644
--- ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
+++ ui/modules/Common/Form/Buttons/ExclusiveButtons.spec.qml
@@ -27,13 +27,6 @@ Item {
 
         texts: ['A', 'B', 'C', 'D', 'E']
       }
-
-      SignalSpy {
-        id: spy
-
-        signalName: 'clicked'
-        target: exclusiveButtons
-      }
     }
   }
 
@@ -54,24 +47,33 @@ Item {
 
     function test_signals (data) {
       var container = buildExclusiveButtons(data.defaultSelectedButton)
-      var spy = container.data[1]
       var exclusiveButtons = container.data[0]
-
       var buttonToClick = data.buttonToClick
 
       // Test default selected button.
       compare(exclusiveButtons.selectedButton, data.defaultSelectedButton)
 
+      var button = -1
+      var count = 0
+
+      exclusiveButtons.clicked.connect(function (_button) {
+        button = _button;
+        count += 1
+      })
+
       // Test a click to change the selected button.
       mouseClick(exclusiveButtons.data[buttonToClick])
-      spy.wait(100)
-      compare(spy.signalArguments[0][0], buttonToClick)
+
+      compare(button, buttonToClick)
       compare(exclusiveButtons.selectedButton, buttonToClick)
+      compare(count, 1)
 
       // No signal must be emitted.
       mouseClick(exclusiveButtons.data[buttonToClick])
-      wait(100)
-      compare(spy.count, 1)
+
+      compare(button, buttonToClick)
+      compare(exclusiveButtons.selectedButton, buttonToClick)
+      compare(count, 1)
 
       container.destroy()
     }