fix(jsunit): Modify `OC.L10N` tests as it does not depend on `OC.` anymore

Meaning we can not stub `getLocale` but must override the document attribute instead.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
pull/36287/head
Ferdinand Thiessen 1 year ago
parent cdc3848345
commit c97137e434

@ -110,8 +110,11 @@ describe('OC.L10N tests', function() {
});
});
describe('async loading of translations', function() {
afterEach(() => {
document.documentElement.removeAttribute('data-locale')
})
it('loads bundle for given app and calls callback', function(done) {
var localeStub = sinon.stub(OC, 'getLocale').returns('zh_CN');
document.documentElement.setAttribute('data-locale', 'zh_CN')
var callbackStub = sinon.stub();
var promiseStub = sinon.stub();
var loading = OC.L10N.load(TEST_APP, callbackStub);
@ -129,9 +132,9 @@ describe('OC.L10N tests', function() {
expect(callbackStub.calledOnce).toEqual(true);
expect(promiseStub.calledOnce).toEqual(true);
expect(t(TEST_APP, 'Hello world!')).toEqual('你好世界!');
localeStub.restore();
})
.then(done);
.then(done)
.catch(e => expect(e).toBe('No error expected!'));
expect(promiseStub.notCalled).toEqual(true);
req.respond(

Loading…
Cancel
Save