mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
5e6db4d2ff
Banner items are created as per design. Banner items support customizable close button. Banner items have hove state as per design. Banner items are added to storybook with all possible configurations. Banner items have a close animation including fade-out and the remaining item occupy the empty space. QML tests are added.
77 lines
2.0 KiB
QML
77 lines
2.0 KiB
QML
import QtQuick 2.15
|
|
import QtTest 1.15
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
Item {
|
|
id: root
|
|
width: 600
|
|
height: 400
|
|
|
|
Component {
|
|
id: bannerCardComponent
|
|
|
|
BannerCard {}
|
|
}
|
|
|
|
TestCase {
|
|
id: bannerCardTest
|
|
|
|
when: windowShown
|
|
|
|
property BannerCard componentUnderTest
|
|
|
|
function init() {
|
|
componentUnderTest = createTemporaryObject(bannerCardComponent, root)
|
|
}
|
|
|
|
function test_empty() {
|
|
compare(componentUnderTest.image, "")
|
|
compare(componentUnderTest.title, "")
|
|
compare(componentUnderTest.subTitle, "")
|
|
compare(componentUnderTest.closeEnabled, true)
|
|
}
|
|
|
|
function test_geometry() {
|
|
verify(componentUnderTest.height > 0)
|
|
verify(componentUnderTest.width > 0)
|
|
}
|
|
|
|
function test_hoverState() {
|
|
compare(componentUnderTest.hovered, false)
|
|
mouseMove(componentUnderTest)
|
|
compare(componentUnderTest.hovered, true)
|
|
|
|
const closeButton = findChild(componentUnderTest, "bannerCard_closeButton")
|
|
verify(!!closeButton)
|
|
verify(closeButton.visible)
|
|
verify(closeButton.width > 0)
|
|
verify(closeButton.height > 0)
|
|
|
|
mouseMove(closeButton, closeButton.width / 2, closeButton.height / 2)
|
|
compare(componentUnderTest.hovered, true)
|
|
}
|
|
|
|
function test_click() {
|
|
let clicked = false
|
|
componentUnderTest.clicked.connect(() => {
|
|
clicked = true
|
|
})
|
|
mouseClick(componentUnderTest)
|
|
compare(clicked, true)
|
|
|
|
clicked = false
|
|
|
|
const closeButton = findChild(componentUnderTest, "bannerCard_closeButton")
|
|
|
|
let closed = false
|
|
componentUnderTest.close.connect(() => {
|
|
closed = true
|
|
})
|
|
mouseClick(closeButton)
|
|
compare(closed, true)
|
|
compare(clicked, false)
|
|
}
|
|
}
|
|
}
|