Skip to content

Commit 8a9ded3

Browse files
authored
Merge pull request #443 from futa-ikeda/fix-gravatar
[ENG-1504] Fix broken gravatar for logged out users
2 parents f815723 + cd9d7c4 commit 8a9ded3

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
### Fixed
9+
- `new-navbar-auth-dropdown` fixed for unauthenticated users
10+
711
## [0.29.0] - 2020-03-25
812
### Changed
913
- `hasDataLinks` and `hasPreregLinks` preprint fields to `string`

addon/components/new-navbar-auth-dropdown/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{# if session.isAuthenticated }}
1+
{{#if session.isAuthenticated }}
22
{{! TODO: Replace display name functionality if possible- for now truncate via CSS at end of label }}
33
{{#bs-dropdown tagName='li' classNames="secondary-nav-dropdown" as |dd|}}
44
{{#dd.toggle tagName="a" classNames="btn-link"}}
Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,41 @@
1+
import Ember from 'ember';
12
import { moduleForComponent, test } from 'ember-qunit';
23
import hbs from 'htmlbars-inline-precompile';
34

5+
6+
// Session Stub No Auth
7+
const sessionStubUnauthenticated = Ember.Service.extend({
8+
isAuthenticated: false
9+
});
10+
11+
// Session Stub Auth
12+
const sessionStubAuthenticated = Ember.Service.extend({
13+
isAuthenticated: true
14+
});
15+
416
moduleForComponent('new-navbar-auth-dropdown', 'Integration | Component | new navbar auth dropdown', {
5-
integration: true
17+
integration: true,
618
});
719

8-
test('it renders', function (assert) {
9-
// Set any properties with this.set('myProperty', 'value');
10-
// Handle any actions with this.on('myAction', function(val) { ... });
20+
test('it renders when session is authenticated', function (assert) {
21+
this.register('service:session', sessionStubAuthenticated);
22+
this.set('loginAction', ()=>{});
23+
this.render(hbs`{{new-navbar-auth-dropdown loginAction=loginAction}}`);
1124

12-
this.set('loginAction', ()=>{});
13-
this.render(hbs`{{new-navbar-auth-dropdown loginAction=loginAction}}`);
25+
assert.notOk(this.$('.btn-top-login').length, 'log in button does not exists for authenticated');
26+
assert.notOk(this.$('.btn-top-signup').length, 'sign up button does not exists for authenticated');
27+
assert.ok(this.$('.osf-profile-image').length, 'has gravatar for authenticated session');
28+
assert.ok(this.$('.nav-profile-name').length, 'has username for authenticated session')
29+
assert.notEqual(this.$().text().trim(), '');
30+
});
1431

15-
assert.notEqual(this.$().text().trim(), '');
32+
test('it renders when session is not authenticated', function (assert) {
33+
this.register('service:session', sessionStubUnauthenticated);
34+
this.set('loginAction', ()=>{});
35+
this.render(hbs`{{new-navbar-auth-dropdown loginAction=loginAction}}`);
36+
assert.ok(this.$('.btn-top-login').length, 'log in button exists for unauthenticated');
37+
assert.ok(this.$('.btn-top-signup').length, 'sign up button exists for unauthenticated');
38+
assert.notOk(this.$('.osf-profile-image').length, 'no gravatar for unauthenticated session');
39+
assert.notOk(this.$('.nav-profile-name').length, 'no username for unauthenticated session')
40+
assert.notEqual(this.$().text().trim(), '');
1641
});

0 commit comments

Comments
 (0)