Skip to content

Commit

Permalink
Issue #589 - display username in Report as button when logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Apr 2, 2015
1 parent c9dfbf4 commit 2ae97b8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 19 additions & 1 deletion tests/functional/reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define([
var url = intern.config.siteRoot;

registerSuite({
name: 'reporting anonymously',
name: 'reporting',

'submit buttons are disabled': function() {
return this.remote
Expand All @@ -30,6 +30,24 @@ define([
});
},

'report button shows name when logged in': function() {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url + '?open=1'))
.findByCssSelector('#submitgithub').getVisibleText()
.findByCssSelector('#submitgithub').getVisibleText()
.then(function (text) {
assert.include(text, 'Report as'); //Report as FooUser (logged in)
})
// log out
.findByCssSelector('.js-login-link').click()
.end()
.then(function (text) {
assert.include(text, 'Report via'); //Report via GitHub (logged out)
})
.end();
},

'validation works': function() {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
Expand Down
4 changes: 3 additions & 1 deletion webcompat/templates/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
</div>
<div class="r-Grid r-Grid--withGutter">
<div class="r-Grid-cell r-all--1of2 wc-ReportForm-button wc-ReportForm-button--github">
<button name="submit-type" value="github-auth-report" class="Button Button--default" id="submitgithub" type="submit">Report via Github</button>
<button name="submit-type" value="github-auth-report" class="Button Button--default" id="submitgithub" type="submit">
{% if session.username %}Report as {{ session.username }}{% else %}Report via Github{% endif %}
</button>
</div>
<div class="r-Grid-cell r-all--1of2 wc-ReportForm-button wc-ReportForm-button--anon">
<button name="submit-type" value="github-proxy-report" class="Button Button--action" id="submitanon">Report Anonymously</button>
Expand Down

0 comments on commit 2ae97b8

Please sign in to comment.