Skip to content

Commit 45ad575

Browse files
Merge pull request #5639 from Countly/SER-1961
[SER-1961] if the user creates a Widget with terms and condition, and edits it "Add user consent" seems is not selected.
2 parents 4c9ffc1 + a1f1e05 commit 45ad575

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

plugins/star-rating/frontend/public/javascripts/countly.views.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@
11451145
steps: null
11461146
};
11471147
}
1148-
if (Array.isArray(this.widget.links)) {
1148+
if (Array.isArray(this.widget.links) && this.widget.links.length) {
11491149
this.widget.links.forEach(function(link) {
11501150
if (link.linkValue.indexOf('term')) {
11511151
link.text = "Terms and Conditions";
@@ -1162,8 +1162,9 @@
11621162
link.linkValue = link.linkValue.replace(new RegExp('[?&]' + CLY_X_INT + '=[^&]*'), '').replace(/[?&]$/, '');
11631163
});
11641164
this.widget.links = {"link": this.widget.links, "finalText": this.widget.finalText};
1165+
this.widget.consent = true;
11651166
}
1166-
if (!this.widget.links) {
1167+
else {
11671168
this.widget.links = {
11681169
"link": [
11691170
{
@@ -1182,6 +1183,7 @@
11821183
"finalText": "I agree to the Terms and Conditions and Privacy Policy."
11831184

11841185
};
1186+
this.widget.consent = false;
11851187
}
11861188
if (!this.widget.rating_symbol) {
11871189
this.widget.rating_symbol = "emojis";

ui-tests/cypress/e2e/dashboard/feedback/ratings/widgets.cy.js

100644100755
+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('Create New Widget', () => {
1616
navigationHelpers.goToFeedbackRatingsWidgetsPage();
1717
});
1818

19-
it('Verify default values of page and create a widget with that values and then update the widget data', function() {
19+
it.skip('Verify default values of page and create a widget with that values and then update the widget data', function() {
2020
widgetsHelpers.clickAddNewWidgetButton();
2121
widgetsHelpers.verifySettingsPageDefaultElements();
2222
widgetsHelpers.typeWidgetName("My New Widget");
@@ -222,6 +222,7 @@ describe('Create New Widget', () => {
222222
contactViaCheckboxLabelText: widget.contactViaCheckboxLabelText,
223223
contactEmail: widgetRate.contactEmail,
224224
submitButtonText: widget.submitButtonText,
225+
hasAggrementCheckbox: true,
225226
selectedMainColor: widget.mainColor,
226227
selectedFontColor: widget.FontColor,
227228
hasPoweredByLogo: true,

ui-tests/cypress/lib/dashboard/feedback/ratings/demoWidgetPage.js

100644100755
+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const verifyDemoPageElementsAndRate = ({
5454
submitButtonText,
5555
submitButtonColor,
5656
submitButtonFontColor,
57+
hasAggrementCheckbox = false,
5758
hasPoweredByLogo = true,
5859
thankYouMessageText,
5960
successIconColor
@@ -132,6 +133,12 @@ const verifyDemoPageElementsAndRate = ({
132133
cy.shouldNotExist(demoPageElements.LOGO_IMAGE);
133134
}
134135

136+
if (hasAggrementCheckbox) {
137+
cy.contains('label', 'I agree to the terms and conditions and privacy policy')
138+
.find('input[type="checkbox"]')
139+
.click();
140+
}
141+
135142
cy.clickElement(demoPageElements.SUBMIT_BUTTON);
136143

137144
// cy.window().then((win) => {

0 commit comments

Comments
 (0)