Fix tests
* Serve translation files from the karma server * Port UserSettingsStore to ES6 exports because the test runner gets confused by ES6 importing a commonjs module * Remove extra spaces in translations strings for MELS * Fix 'his/her' back to be 'their' * Change test to expect singular 'invitation' for a single person (there may be multiple invitations, but IMO this should be 'rejected n invitations' and we can play with the wording later, I don't think the singular is any worse than the plural). * set language in the MELS tests (and wait for it to complete) * Don't bother setting lang in other tests for nowpull/21833/head
parent
dfc8cf3f54
commit
e44f3cc709
|
@ -55,11 +55,18 @@ module.exports = function (config) {
|
|||
// some images to reduce noise from the tests
|
||||
{pattern: 'test/img/*', watched: false, included: false,
|
||||
served: true, nocache: false},
|
||||
// translation files
|
||||
{pattern: 'src/i18n/strings/*', watcheed: false, included: false, served: true},
|
||||
{pattern: 'test/i18n/*', watched: false, included: false, served: true},
|
||||
],
|
||||
|
||||
// redirect img links to the karma server
|
||||
proxies: {
|
||||
// redirect img links to the karma server
|
||||
"/img/": "/base/test/img/",
|
||||
// special languages.json file for the tests
|
||||
"/i18n/languages.json": "/base/test/i18n/languages.json",
|
||||
// and redirect i18n requests
|
||||
"/i18n/": "/base/src/i18n/strings/",
|
||||
},
|
||||
|
||||
// list of files to exclude
|
||||
|
|
|
@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
import q from 'q';
|
||||
import MatrixClientPeg from './MatrixClientPeg';
|
||||
import Notifier from './Notifier';
|
||||
|
@ -27,7 +26,7 @@ import Notifier from './Notifier';
|
|||
* TODO: Find a way to translate the names of LABS_FEATURES. In other words, guarantee that languages were already loaded before building this array.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
LABS_FEATURES: [
|
||||
{
|
||||
name: "New Composer & Autocomplete",
|
||||
|
|
|
@ -260,22 +260,22 @@ module.exports = React.createClass({
|
|||
if (repeats > 1) {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)srejected their invitations %(repeats)s times", { severalUsers: "", repeats: repeats })
|
||||
: _t("%(oneUser)s rejected his/her invitation %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
: _t("%(oneUser)srejected their invitation %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
} else {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)srejected their invitations", { severalUsers: "" })
|
||||
: _t("%(oneUser)s rejected his/her invitation", { oneUser: "" });
|
||||
: _t("%(oneUser)srejected their invitation", { oneUser: "" });
|
||||
}
|
||||
break;
|
||||
case "invite_withdrawal":
|
||||
if (repeats > 1) {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)shad their invitations withdrawn %(repeats)s times", { severalUsers: "", repeats: repeats })
|
||||
: _t("%(oneUser)s had his/her invitation withdrawn %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
: _t("%(oneUser)shad their invitation withdrawn %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
} else {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)shad their invitations withdrawn", { severalUsers: "" })
|
||||
: _t("%(oneUser)s had his/her invitation withdrawn", { oneUser: "" });
|
||||
: _t("%(oneUser)shad their invitation withdrawn", { oneUser: "" });
|
||||
}
|
||||
break;
|
||||
case "invited":
|
||||
|
@ -326,22 +326,22 @@ module.exports = React.createClass({
|
|||
if (repeats > 1) {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)schanged their name %(repeats)s times", { severalUsers: "", repeats: repeats })
|
||||
: _t("%(oneUser)s changed his/her name %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
: _t("%(oneUser)schanged their name %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
} else {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)schanged their name", { severalUsers: "" })
|
||||
: _t("%(oneUser)s changed his/her name", { oneUser: "" });
|
||||
: _t("%(oneUser)schanged their name", { oneUser: "" });
|
||||
}
|
||||
break;
|
||||
case "changed_avatar":
|
||||
if (repeats > 1) {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)schanged their avatar %(repeats)s times", { severalUsers: "", repeats: repeats })
|
||||
: _t("%(oneUser)s changed his/her avatar %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
: _t("%(oneUser)schanged their avatar %(repeats)s times", { oneUser: "", repeats: repeats });
|
||||
} else {
|
||||
res = (plural)
|
||||
? _t("%(severalUsers)schanged their avatar", { severalUsers: "" })
|
||||
: _t("%(oneUser)s changed his/her avatar", { oneUser: "" });
|
||||
: _t("%(oneUser)schanged their avatar", { oneUser: "" });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -671,13 +671,13 @@
|
|||
"%(severalUsers)sleft and rejoined": "%(severalUsers)sgingen und traten erneut bei",
|
||||
"%(oneUser)sleft left and rejoined": "%(oneUser)sging und trat erneut bei",
|
||||
"%(severalUsers)srejected their invitations %(repeats)s times": "%(severalUsers)slehnten %(repeats)s mal ihre Einladung ab",
|
||||
"%(oneUser)s rejected his/her invitation %(repeats)s times": "%(oneUser)s lehnte seine/ihre Einladung %(repeats)s mal ab",
|
||||
"%(oneUser)srejected their invitation %(repeats)s times": "%(oneUser)slehnte seine/ihre Einladung %(repeats)s mal ab",
|
||||
"%(severalUsers)srejected their invitations": "%(severalUsers)slehnten ihre Einladung ab",
|
||||
"%(oneUser)s rejected his/her invitation": "%(oneUser)s lehnte seine/ihre Einladung ab",
|
||||
"%(oneUser)srejected their invitation": "%(oneUser)slehnte seine/ihre Einladung ab",
|
||||
"%(severalUsers)shad their invitations withdrawn %(repeats)s times": "%(severalUsers)szogen ihre Einladungen %(repeats)s mal zurück",
|
||||
"%(oneUser)s had his/her invitation withdrawn %(repeats)s times": "%(oneUser)s zog seine/ihre Einladung %(repeats)s mal zurück",
|
||||
"%(oneUser)shad their invitation withdrawn %(repeats)s times": "%(oneUser)szog seine/ihre Einladung %(repeats)s mal zurück",
|
||||
"%(severalUsers)shad their invitations withdrawn": "%(severalUsers)szogen ihre Einladungen zurück",
|
||||
"%(oneUser)s had his/her invitation withdrawn": "%(oneUser)s zog seine/ihre Einladung zurück",
|
||||
"%(oneUser)shad their invitation withdrawn": "%(oneUser)szog seine/ihre Einladung zurück",
|
||||
"were invited %(repeats)s times": "wurden %(repeats)s mal eingeladen",
|
||||
"was invited %(repeats)s times": "wurde %(repeats)s mal eingeladen",
|
||||
"were invited": "wurden eingeladen",
|
||||
|
@ -691,13 +691,13 @@
|
|||
"was kicked %(repeats)s times": "wurde %(repeats)s mal gekickt",
|
||||
"were kicked": "wurden gekickt",
|
||||
"%(severalUsers)schanged their name %(repeats)s times": "%(severalUsers)sänderten %(repeats)s mal ihre Namen",
|
||||
"%(oneUser)s changed his/her name %(repeats)s times": "%(oneUser)s änderte %(repeats)s mal seinen/ihren Namen",
|
||||
"%(oneUser)schanged their name %(repeats)s times": "%(oneUser)sänderte %(repeats)s mal seinen/ihren Namen",
|
||||
"%(severalUsers)schanged their name": "%(severalUsers)sänderten ihre Namen",
|
||||
"%(oneUser)s changed his/her name": "%(oneUser)s änderte seinen/ihren Namen",
|
||||
"%(oneUser)schanged their name": "%(oneUser)sänderte seinen/ihren Namen",
|
||||
"%(severalUsers)schanged their avatar %(repeats)s times": "%(severalUsers)sänderten %(repeats)s mal ihren Avatar",
|
||||
"%(oneUser)s changed his/her avatar %(repeats)s times": "%(oneUser)s änderte %(repeats)s mal seinen/ihren Avatar",
|
||||
"%(oneUser)schanged their avatar %(repeats)s times": "%(oneUser)sänderte %(repeats)s mal seinen/ihren Avatar",
|
||||
"%(severalUsers)schanged their avatar": "%(severalUsers)sänderten ihre Avatare",
|
||||
"%(oneUser)s changed his/her avatar": "%(severalUsers)s änderte seinen/ihren Avatar",
|
||||
"%(oneUser)schanged their avatar": "%(severalUsers)sänderte seinen/ihren Avatar",
|
||||
"%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(day)s. %(monthName)s %(fullYear)s %(time)s",
|
||||
"%(oneUser)sleft and rejoined": "%(oneUser)sging und trat erneut bei"
|
||||
}
|
||||
|
|
|
@ -629,13 +629,13 @@
|
|||
"%(severalUsers)sleft and rejoined": "%(severalUsers)sleft and rejoined",
|
||||
"%(oneUser)sleft and rejoined": "%(oneUser)sleft and rejoined",
|
||||
"%(severalUsers)srejected their invitations %(repeats)s times": "%(severalUsers)srejected their invitations %(repeats)s times",
|
||||
"%(oneUser)s rejected his/her invitation %(repeats)s times": "%(oneUser)s rejected his/her invitation %(repeats)s times",
|
||||
"%(oneUser)srejected their invitation %(repeats)s times": "%(oneUser)srejected their invitation %(repeats)s times",
|
||||
"%(severalUsers)srejected their invitations": "%(severalUsers)srejected their invitations",
|
||||
"%(oneUser)s rejected his/her invitation": "%(oneUser)s rejected his/her invitation",
|
||||
"%(oneUser)srejected their invitation": "%(oneUser)srejected their invitation",
|
||||
"%(severalUsers)shad their invitations withdrawn %(repeats)s times": "%(severalUsers)shad their invitations withdrawn %(repeats)s times",
|
||||
"%(oneUser)s had his/her invitation withdrawn %(repeats)s times": "%(oneUser)s had his/her invitation withdrawn %(repeats)s times",
|
||||
"%(oneUser)shad their invitation withdrawn %(repeats)s times": "%(oneUser)shad their invitation withdrawn %(repeats)s times",
|
||||
"%(severalUsers)shad their invitations withdrawn": "%(severalUsers)shad their invitations withdrawn",
|
||||
"%(oneUser)s had his/her invitation withdrawn": "%(oneUser)s had his/her invitation withdrawn",
|
||||
"%(oneUser)shad their invitation withdrawn": "%(oneUser)shad their invitation withdrawn",
|
||||
"were invited %(repeats)s times": "were invited %(repeats)s times",
|
||||
"was invited %(repeats)s times": "was invited %(repeats)s times",
|
||||
"were invited": "were invited",
|
||||
|
@ -653,11 +653,11 @@
|
|||
"were kicked": "were kicked",
|
||||
"was kicked": "was kicked",
|
||||
"%(severalUsers)schanged their name %(repeats)s times": "%(severalUsers)schanged their name %(repeats)s times",
|
||||
"%(oneUser)s changed his/her name %(repeats)s times": "%(oneUser)s changed his/her name %(repeats)s times",
|
||||
"%(oneUser)schanged their name %(repeats)s times": "%(oneUser)schanged their name %(repeats)s times",
|
||||
"%(severalUsers)schanged their name": "%(severalUsers)schanged their name",
|
||||
"%(oneUser)s changed his/her name": "%(oneUser)s changed his/her name",
|
||||
"%(oneUser)schanged their name": "%(oneUser)schanged their name",
|
||||
"%(severalUsers)schanged their avatar %(repeats)s times": "%(severalUsers)schanged their avatar %(repeats)s times",
|
||||
"%(oneUser)s changed his/her avatar %(repeats)s times": "%(oneUser)s changed his/her avatar %(repeats)s times",
|
||||
"%(oneUser)schanged their avatar %(repeats)s times": "%(oneUser)schanged their avatar %(repeats)s times",
|
||||
"%(severalUsers)schanged their avatar": "%(severalUsers)schanged their avatar",
|
||||
"%(oneUser)s changed his/her avatar": "%(oneUser)s changed his/her avatar"
|
||||
"%(oneUser)schanged their avatar": "%(oneUser)schanged their avatar"
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@
|
|||
"es-mx": "Espanhol (México)",
|
||||
"es-ni": "Espanhol (Nicarágua)",
|
||||
"es-pa": "Espanhol (Panamá)",
|
||||
"%(oneUser)s changed his/her avatar": "%(oneUser)s alterou sua imagem pública",
|
||||
"%(oneUser)schanged their avatar": "%(oneUser)salterou sua imagem pública",
|
||||
"es-pe": "Espanhol (Peru)",
|
||||
"es-pr": "Espanhol (Porto Rico)",
|
||||
"es-sv": "Espanhol (El Salvador)",
|
||||
|
@ -676,13 +676,13 @@
|
|||
"%(severalUsers)sleft and rejoined": "%(severalUsers)ssaíram e entraram novamente",
|
||||
"%(oneUser)sleft and rejoined": "%(oneUser)ssaiu e entrou novamente",
|
||||
"%(severalUsers)srejected their invitations %(repeats)s times": "%(severalUsers)srejeitaram seus convites %(repeats)s vezes",
|
||||
"%(oneUser)s rejected his/her invitation %(repeats)s times": "%(oneUser)s rejeitou seu convite %(repeats)s vezes",
|
||||
"%(oneUser)srejected their invitation %(repeats)s times": "%(oneUser)srejeitou seu convite %(repeats)s vezes",
|
||||
"%(severalUsers)srejected their invitations": "%(severalUsers)srejeitaram seus convites",
|
||||
"%(oneUser)s rejected his/her invitation": "%(oneUser)s rejeitou seu convite",
|
||||
"%(oneUser)srejected their invitation": "%(oneUser)srejeitou seu convite",
|
||||
"%(severalUsers)shad their invitations withdrawn %(repeats)s times": "%(severalUsers)stiveram seus convites desfeitos %(repeats)s vezes",
|
||||
"%(oneUser)s had his/her invitation withdrawn %(repeats)s times": "%(oneUser)s teve seu convite desfeito %(repeats)s vezes",
|
||||
"%(oneUser)shad their invitation withdrawn %(repeats)s times": "%(oneUser)steve seu convite desfeito %(repeats)s vezes",
|
||||
"%(severalUsers)shad their invitations withdrawn": "%(severalUsers)stiveram seus convites desfeitos",
|
||||
"%(oneUser)s had his/her invitation withdrawn": "%(oneUser)s teve seu convite desfeito",
|
||||
"%(oneUser)shad their invitation withdrawn": "%(oneUser)steve seu convite desfeito",
|
||||
"were invited %(repeats)s times": "foram convidadas(os) %(repeats)s vezes",
|
||||
"was invited %(repeats)s times": "foi convidada(o) %(repeats)s vezes",
|
||||
"were invited": "foram convidadas(os)",
|
||||
|
@ -696,11 +696,11 @@
|
|||
"was kicked %(repeats)s times": "foi expulsa(o) %(repeats)s vezes",
|
||||
"were kicked": "foram expulsas(os)",
|
||||
"%(severalUsers)schanged their name %(repeats)s times": "%(severalUsers)salteraram seu nome %(repeats)s vezes",
|
||||
"%(oneUser)s changed his/her name %(repeats)s times": "%(oneUser)s alterou seu nome %(repeats)s vezes",
|
||||
"%(oneUser)schanged their name %(repeats)s times": "%(oneUser)salterou seu nome %(repeats)s vezes",
|
||||
"%(severalUsers)schanged their name": "%(severalUsers)salteraram seus nomes",
|
||||
"%(oneUser)s changed his/her name": "%(oneUser)s alterou seu nome",
|
||||
"%(oneUser)schanged their name": "%(oneUser)salterou seu nome",
|
||||
"%(severalUsers)schanged their avatar %(repeats)s times": "%(severalUsers)salteraram sua imagem pública %(repeats)s vezes",
|
||||
"%(oneUser)s changed his/her avatar %(repeats)s times": "%(oneUser)s alterou sua imagem pública %(repeats)s vezes",
|
||||
"%(oneUser)schanged their avatar %(repeats)s times": "%(oneUser)salterou sua imagem pública %(repeats)s vezes",
|
||||
"%(severalUsers)schanged their avatar": "%(severalUsers)salteraram sua imagem pública",
|
||||
"Ban": "Banir"
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ const ReactDOM = require("react-dom");
|
|||
const ReactTestUtils = require('react-addons-test-utils');
|
||||
const sdk = require('matrix-react-sdk');
|
||||
const MemberEventListSummary = sdk.getComponent('views.elements.MemberEventListSummary');
|
||||
import * as languageHandler from '../../../../src/languageHandler';
|
||||
|
||||
const testUtils = require('../../../test-utils');
|
||||
describe('MemberEventListSummary', function() {
|
||||
|
@ -82,9 +83,11 @@ describe('MemberEventListSummary', function() {
|
|||
return eventsForUsers;
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function(done) {
|
||||
testUtils.beforeEach(this);
|
||||
sandbox = testUtils.stubClient();
|
||||
|
||||
languageHandler.setLanguage('en').done(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
@ -356,7 +359,7 @@ describe('MemberEventListSummary', function() {
|
|||
const summaryText = summary.innerText;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 and 1 other were unbanned, joined and left 2 times and were banned"
|
||||
"user_1 and one other were unbanned, joined and left 2 times and were banned"
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -559,7 +562,7 @@ describe('MemberEventListSummary', function() {
|
|||
const summaryText = summary.innerText;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 and 1 other rejected their invitations and " +
|
||||
"user_1 and one other rejected their invitations and " +
|
||||
"had their invitations withdrawn"
|
||||
);
|
||||
});
|
||||
|
@ -595,7 +598,7 @@ describe('MemberEventListSummary', function() {
|
|||
const summaryText = summary.innerText;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 rejected their invitations 2 times"
|
||||
"user_1 rejected their invitation 2 times"
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -650,7 +653,7 @@ describe('MemberEventListSummary', function() {
|
|||
const summaryText = summary.innerText;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1, user_2 and 1 other joined"
|
||||
"user_1, user_2 and one other joined"
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
import sinon from 'sinon';
|
||||
import q from 'q';
|
||||
import ReactTestUtils from 'react-addons-test-utils';
|
||||
import * as counterpart from 'counterpart-riot';
|
||||
var languageHandler = require("../src/languageHandler");
|
||||
|
||||
import peg from '../src/MatrixClientPeg.js';
|
||||
import jssdk from 'matrix-js-sdk';
|
||||
|
@ -67,10 +65,6 @@ export function beforeEach(context) {
|
|||
|
||||
console.log(desc);
|
||||
console.log(new Array(1 + desc.length).join("="));
|
||||
|
||||
const languages = languageHandler.getNormalizedLanguageKeys('en');
|
||||
languageHandler.setLanguage(languages, counterpart);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue