mirror of
https://github.com/documize/community.git
synced 2025-08-08 15:05:28 +02:00
WIP Test fixes
This commit is contained in:
parent
96baf84f1d
commit
5333cf22f4
6 changed files with 4 additions and 67 deletions
|
@ -3,6 +3,7 @@ import Ember from 'ember';
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
userService: Ember.inject.service('user'),
|
userService: Ember.inject.service('user'),
|
||||||
password: { password: "", confirmation: ""},
|
password: { password: "", confirmation: ""},
|
||||||
|
session: Ember.inject.service(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
save: function() {
|
save: function() {
|
||||||
|
|
|
@ -74,6 +74,7 @@ test('changing space name', function(assert) {
|
||||||
server.createList('permission', 4);
|
server.createList('permission', 4);
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
visit('/s/VzMuyEw_3WqiafcG/my-project/settings');
|
||||||
|
return pauseTest();
|
||||||
|
|
||||||
fillIn('#folderName', 'Test Space');
|
fillIn('#folderName', 'Test Space');
|
||||||
click('.button-blue');
|
click('.button-blue');
|
||||||
|
|
|
@ -23,7 +23,7 @@ test('changing user details and email ', function(assert) {
|
||||||
|
|
||||||
andThen(function() {
|
andThen(function() {
|
||||||
assert.equal(currentURL(), '/profile');
|
assert.equal(currentURL(), '/profile');
|
||||||
assert.equal(find('.name').text().trim(), 'Lennex Zinyando', 'Profile name displayed');
|
assert.equal(find('.content .name').text().trim(), 'Lennex Zinyando', 'Profile name displayed');
|
||||||
assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
|
assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
|
||||||
assert.equal(find('#lastname').val(), 'Zinyando', 'Lastname input displays correct value');
|
assert.equal(find('#lastname').val(), 'Zinyando', 'Lastname input displays correct value');
|
||||||
assert.equal(find('#email').val(), 'brizdigital@gmail.com', 'Email input displays correct value');
|
assert.equal(find('#email').val(), 'brizdigital@gmail.com', 'Email input displays correct value');
|
||||||
|
|
|
@ -95,6 +95,5 @@ function checkForCommonAsserts() {
|
||||||
findWithAssert('.sidebar-menu');
|
findWithAssert('.sidebar-menu');
|
||||||
findWithAssert('#user-button');
|
findWithAssert('#user-button');
|
||||||
findWithAssert('#accounts-button');
|
findWithAssert('#accounts-button');
|
||||||
findWithAssert('a:contains(Dashboard)');
|
findWithAssert('.info .title');
|
||||||
findWithAssert('a:contains(Settings)');
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import Application from '../../app';
|
import Application from '../../app';
|
||||||
import config from '../../config/environment';
|
import config from '../../config/environment';
|
||||||
import './stub-session';
|
|
||||||
import './stub-audit';
|
import './stub-audit';
|
||||||
import './user-login';
|
import './user-login';
|
||||||
import './wait-to-appear';
|
import './wait-to-appear';
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
||||||
//
|
|
||||||
// This software (Documize Community Edition) is licensed under
|
|
||||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
//
|
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
|
||||||
// by contacting <sales@documize.com>.
|
|
||||||
//
|
|
||||||
// https://documize.com
|
|
||||||
|
|
||||||
import Ember from 'ember';
|
|
||||||
import encodingUtil from 'documize/utils/encoding';
|
|
||||||
import netUtil from 'documize/utils/net';
|
|
||||||
import models from 'documize/utils/model';
|
|
||||||
import SimpleAuthSession from 'ember-simple-auth/services/session';
|
|
||||||
|
|
||||||
const {
|
|
||||||
inject: { service },
|
|
||||||
computed: { oneWay, or },
|
|
||||||
computed
|
|
||||||
} = Ember;
|
|
||||||
|
|
||||||
const Session = SimpleAuthSession.extend({
|
|
||||||
ajax: service(),
|
|
||||||
appMeta: service(),
|
|
||||||
|
|
||||||
authenticated: oneWay('isAuthenticated'),
|
|
||||||
isAdmin: oneWay('user.admin'),
|
|
||||||
isEditor: or('user.admin', 'user.editor'),
|
|
||||||
|
|
||||||
user: computed('session.content.authenticated.user', function(){
|
|
||||||
let user = this.get('session.content.authenticated.user');
|
|
||||||
if (user) {
|
|
||||||
return models.UserModel.create(user);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
folderPermissions: null,
|
|
||||||
currentFolder: null,
|
|
||||||
|
|
||||||
clearSession: function() {
|
|
||||||
// TODO: clear session properly with ESA
|
|
||||||
// localStorage.clear();
|
|
||||||
},
|
|
||||||
|
|
||||||
storeSessionItem: function() {
|
|
||||||
// localStorage[key] = data;
|
|
||||||
},
|
|
||||||
|
|
||||||
getSessionItem: function() {
|
|
||||||
// return localStorage[key];
|
|
||||||
},
|
|
||||||
|
|
||||||
clearSessionItem: function() {
|
|
||||||
// delete localStorage[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export default Ember.Test.registerAsyncHelper('stubSession', function(app, test, attrs={}) {
|
|
||||||
test.register('service:session', Session.extend(attrs));
|
|
||||||
});
|
|
Loading…
Add table
Add a link
Reference in a new issue