Skip to content

Commit 5f037d4

Browse files
author
Mike Taylor
authored
Merge pull request #3424 from webcompat/issue/3395/1
Fixes #3395 - Change copy after filing an issue with "Report site issue" reporter
2 parents abcd840 + 4f64284 commit 5f037d4

File tree

6 files changed

+71
-6
lines changed

6 files changed

+71
-6
lines changed

tests/functional/reporting-direct.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use strict";
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
const intern = require("intern").default;
6+
const { assert } = intern.getPlugin("chai");
7+
const { registerSuite } = intern.getInterface("object");
8+
const FunctionalHelpers = require("./lib/helpers.js");
9+
10+
const url = intern.config.functionalBaseUrl + "issues/new";
11+
12+
registerSuite("Reporting directly", {
13+
tests: {
14+
"Ask for url in the description"() {
15+
return FunctionalHelpers.openPage(this, url, "#js-ReportForm")
16+
.findByCssSelector("#desc-url")
17+
.getAttribute("class")
18+
.then((className) => {
19+
assert.include(className, "is-hidden");
20+
})
21+
.end()
22+
.findByCssSelector("#desc-no-url")
23+
.getAttribute("class")
24+
.then((className) => {
25+
assert.isNull(className);
26+
})
27+
.end();
28+
},
29+
},
30+
});

tests/functional/reporting-get-params.js

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ registerSuite("Reporting through passing GET params", {
3232
.then(function (value) {
3333
assert.equal(value, true);
3434
})
35+
.end()
36+
.findByCssSelector("#desc-url")
37+
.getAttribute("class")
38+
.then((className) => {
39+
assert.notInclude(className, "is-hidden");
40+
})
41+
.end()
42+
.findByCssSelector("#desc-no-url")
43+
.getAttribute("class")
44+
.then((className) => {
45+
assert.include(className, "is-hidden");
46+
})
3547
.end();
3648
},
3749
},

tests/functional/reporting-postMessage.js

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ registerSuite("Reporting through postMessage", {
4646
assert.include(value, "type-marfeel");
4747
})
4848
.end()
49+
.findByCssSelector("#desc-url")
50+
.getAttribute("class")
51+
.then((className) => {
52+
assert.notInclude(className, "is-hidden");
53+
})
54+
.end()
55+
.findByCssSelector("#desc-no-url")
56+
.getAttribute("class")
57+
.then((className) => {
58+
assert.include(className, "is-hidden");
59+
})
60+
.end()
4961
);
5062
},
5163
},

webcompat/static/js/lib/wizard/steps/submit.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,14 @@ const submitForm = function () {
5353
const dfd = $.Deferred();
5454
const formEl = form.get(0);
5555

56-
sendAnalyticsEvent("success", "end");
57-
5856
formEl.submit();
5957
dfd.resolve();
6058
return dfd.promise();
6159
};
6260

6361
const onFormSubmit = (event) => {
6462
event.preventDefault();
63+
sendAnalyticsEvent("success", "end");
6564
disableSubmits();
6665
showLoadingIndicator();
6766
uploadConsoleLogs().always(() => uploadImage().then(submitForm));

webcompat/static/js/lib/wizard/steps/url.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
import $ from "jquery";
88

99
import notify from "../notify.js";
10-
import { isUrlValid } from "../validation.js";
10+
import { isUrlValid, isEmpty } from "../validation.js";
1111
import { extractPrettyUrl } from "../utils.js";
1212
import { showError, showSuccess, hideSuccess } from "../ui-utils.js";
1313
import { sendAnalyticsEvent } from "../analytics.js";
1414

1515
const urlField = $("#url");
1616
const nextStepButton = $(".next-url");
17+
const urlDesc = $("#desc-url");
18+
const noUrlDesc = $("#desc-no-url");
1719

1820
const showNextStep = (id, data) => notify.publish("showStep", { id, data });
1921

@@ -43,11 +45,19 @@ const onBlur = (value) => {
4345
handleEvent(value, () => showError(urlField, "A valid URL is required."));
4446
};
4547

48+
const updateDescription = (val) => {
49+
if (!isEmpty(val)) {
50+
urlDesc.removeClass("is-hidden");
51+
noUrlDesc.addClass("is-hidden");
52+
}
53+
};
54+
4655
const initListeners = () => {
4756
urlField.on("input", (event) => onChange(event.target.value));
4857
urlField.on("blur", (event) => onBlur(event.target.value));
4958
nextStepButton.on("click", onClick);
5059
urlField.trigger("input");
60+
updateDescription(urlField.val());
5161
};
5262

5363
initListeners();
@@ -57,5 +67,6 @@ export default {
5767
update: ({ url }) => {
5868
if (!url) return;
5969
urlField.val(url).trigger("input");
70+
updateDescription(url);
6071
},
6172
};

webcompat/templates/issue-wizard-form.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ <h3 class="page-heading">Filing a web compatibility issue</h3>
1515
<div class="input-control half">
1616
<div class="col">
1717
<div class="input-description">
18-
{% if request.args.get('url') %}
18+
<div id="desc-url" class="is-hidden">
1919
Thank you for filing a web compatibility issue.
2020
<a href="#" class="popup-trigger mobile-only" data-popup-trigger="what-is-webcompat">Learn more</a>
2121
<br>
2222
Do we have the <strong>correct site?</strong>
23-
{% else %}
23+
</div>
24+
<div id="desc-no-url">
2425
<strong>Please enter the URL</strong> where you encountered the web compatibility issue.
2526
<a href="#" class="popup-trigger mobile-only" data-popup-trigger="what-is-webcompat">Learn more</a>
26-
{% endif %}
27+
</div>
2728
</div>
2829
<div class="form-text form-element js-Form-group form-label-message with-validation-icons">
2930
{{ form.url.label(class_='form-label is-hidden') }}

0 commit comments

Comments
 (0)