Fix highlighting of current user in contributor list
Fixes #72 Introduces a helper to determine if a contributor is the current user.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Helper | is-current-user', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('should be true if the given contributor is the current user', function (assert) {
|
||||
const kredits = this.owner.lookup('service:kredits');
|
||||
const currentUser = {
|
||||
account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
|
||||
}
|
||||
kredits.set('currentUser', currentUser);
|
||||
|
||||
const contributor = {
|
||||
account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
|
||||
}
|
||||
|
||||
const isCurrentUser = this.owner.factoryFor('helper:is-current-user').create();
|
||||
|
||||
assert.ok(isCurrentUser.compute([contributor]));
|
||||
});
|
||||
|
||||
test('should be false if the given contributor is not the current user', function (assert) {
|
||||
const kredits = this.owner.lookup('service:kredits');
|
||||
const currentUser = {
|
||||
account: '0xD4264570B12dA659Ee4BBd41c3509B7b1F9c23AC'
|
||||
}
|
||||
kredits.set('currentUser', currentUser);
|
||||
|
||||
const contributor = {
|
||||
account: '0xA4264570B12dA659Ee4BBd51c3509B7b1F9c23AC'
|
||||
}
|
||||
|
||||
const isCurrentUser = this.owner.factoryFor('helper:is-current-user').create();
|
||||
|
||||
assert.notOk(isCurrentUser.compute([contributor]));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user