on xenial help sign in
Fixes as review
commit419a29bef5096e665cfc4fa765afa05a11acfe79 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateMon 6 Jul 2015, 12:15 (11 years ago) parent7688045
2 files changed+27−44
qml/Dash/Previews/PreviewCommentInput.qml+24−41 tests/qmltests/Dash/Previews/tst_PreviewCommentInput.qml+3−3
qml/Dash/Previews/PreviewCommentInput.qml+24−41
@@ -28,56 +28,39 @@ import "../../Components"
2828
2929PreviewWidget {
3030 id: root
31− implicitHeight: commentContainer.implicitHeight
32−
33− property alias commentText: commentTextArea.text
31+ implicitHeight: commentTextArea.implicitHeight
3432
3533 function submit() {
3634 var data = { "comment": commentTextArea.text };
3735 triggered(root.widgetId, "commented", data);
3836 }
3937
40− Item {
41− id: commentContainer
42− implicitHeight: commentSubmitContainer.implicitHeight + anchors.topMargin
43−
44− readonly property real innerMargin: units.gu(1)
45−
46− anchors.fill: parent
47−
48− Item {
49− id: commentSubmitContainer
50− anchors.fill: parent
51− implicitHeight: commentTextArea.implicitHeight + anchors.topMargin
52−
53− TextArea {
54− id: commentTextArea
55− objectName: "commentTextArea"
56− anchors {
57− top: parent.top
58− left: parent.left
59− right: submitButton.left
60− rightMargin: commentContainer.innerMargin
61− }
62− autoSize: true
63− }
38+ TextArea {
39+ id: commentTextArea
40+ objectName: "commentTextArea"
41+ anchors {
42+ top: parent.top
43+ left: parent.left
44+ right: submitButton.left
45+ rightMargin: units.gu(1)
46+ }
47+ autoSize: true
48+ }
6449
65− Button {
66− id: submitButton
67− objectName: "submitButton"
50+ Button {
51+ id: submitButton
52+ objectName: "submitButton"
6853
69− readonly property bool readyToSubmit: commentTextArea.text.trim().length > 0
54+ readonly property bool readyToSubmit: commentTextArea.text.trim().length > 0
7055
71− anchors {
72− top: parent.top
73− right: parent.right
74− }
75− color: readyToSubmit ? Theme.palette.selected.base : Theme.palette.normal.base
76− text: widgetData["submit-label"] || i18n.tr("Send")
77− onClicked: {
78− if (readyToSubmit) root.submit()
79− }
80− }
56+ anchors {
57+ top: parent.top
58+ right: parent.right
59+ }
60+ color: readyToSubmit ? Theme.palette.selected.base : Theme.palette.normal.base
61+ text: widgetData["submit-label"] || i18n.tr("Send")
62+ onClicked: {
63+ if (readyToSubmit) root.submit()
8164 }
8265 }
8366}
tests/qmltests/Dash/Previews/tst_PreviewCommentInput.qml+3−3
@@ -26,8 +26,6 @@ Rectangle {
2626 height: units.gu(80)
2727 color: Theme.palette.selected.background
2828
29− property real validInputRating: 1
30− property real invalidInputRating: -1
3129 property string validInputText: "Great!"
3230 property string invalidInputText: ""
3331
@@ -75,10 +73,12 @@ Rectangle {
7573
7674 commentTextArea.text = data.inputText;
7775 mouseClick(submitButton);
78− if (data.inputText === "") {
76+ if (!data.emitted) {
7977 compare(spy.count, 0);
8078 } else {
8179 compare(spy.count, 1);
80+ var args = spy.signalArguments[0];
81+ compare(args[2]["comment"], data.inputText);
8282 }
8383 }
8484 }