Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: remove legacy tests covered by library unit tests
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and AndyScherzinger committed Jun 18, 2025
commit 6a211b244b79a2959933c4fab97e66e56c62534e
63 changes: 0 additions & 63 deletions core/js/tests/specs/l10nSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,67 +110,4 @@ describe('OC.L10N tests', function() {
checkPlurals();
});
});
describe('async loading of translations', function() {
afterEach(() => {
document.documentElement.removeAttribute('data-locale')
})
it('loads bundle for given app and calls callback', function(done) {
document.documentElement.setAttribute('data-locale', 'zh_CN')
var callbackStub = sinon.stub();
var promiseStub = sinon.stub();
var loading = OC.L10N.load(TEST_APP, callbackStub);
expect(callbackStub.notCalled).toEqual(true);
var req = fakeServer.requests[0];

console.warn('fff-', window.OC.appswebroots)
loading
.then(promiseStub)
.then(function() {
expect(fakeServer.requests.length).toEqual(1);
expect(req.url).toEqual(
OC.getRootPath() + '/apps3/' + TEST_APP + '/l10n/zh_CN.json'
);

expect(callbackStub.calledOnce).toEqual(true);
expect(promiseStub.calledOnce).toEqual(true);
expect(t(TEST_APP, 'Hello world!')).toEqual('你好世界!');
})
.then(done)
.catch(e => expect(e).toBe('No error expected!'));

expect(promiseStub.notCalled).toEqual(true);
req.respond(
200,
{ 'Content-Type': 'application/json' },
JSON.stringify({
translations: {'Hello world!': '你好世界!'},
pluralForm: 'nplurals=2; plural=(n != 1);'
})
);
});
it('calls callback if translation already available', function(done) {
var callbackStub = sinon.stub();
spyOn(console, 'warn');
OC.L10N.register(TEST_APP, {
'Hello world!': 'Hallo Welt!'
});
OC.L10N.load(TEST_APP, callbackStub)
.then(function() {
expect(callbackStub.calledOnce).toEqual(true);
expect(fakeServer.requests.length).toEqual(0);
})
.then(done);

});
it('calls callback if locale is en', function(done) {
var callbackStub = sinon.stub();
OC.L10N.load(TEST_APP, callbackStub)
.then(function() {
expect(callbackStub.calledOnce).toEqual(true);
expect(fakeServer.requests.length).toEqual(0);
})
.then(done)
.catch(done);
});
});
});
Loading