Skip to content

Commit 2abaf8c

Browse files
author
Carlos Lizaga
committed
Added translate.test.js for Jasmine compatibility unit testing.
Removed transtale-test.js from jsTestDriver suite.
1 parent 6bce6f7 commit 2abaf8c

File tree

2 files changed

+45
-47
lines changed

2 files changed

+45
-47
lines changed

dev/tests/js/JsTestDriver/testsuite/mage/translate/translate-test.js

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define([
6+
'jquery',
7+
'mage/translate'
8+
], function ($) {
9+
'use strict';
10+
11+
describe('Test for mage/translate jQuery plugin', function () {
12+
it('works with one string as parameter', function () {
13+
$.mage.translate.add('Hello World!');
14+
expect('Hello World!').toEqual($.mage.translate.translate('Hello World!'));
15+
});
16+
it('works with one array as parameter', function () {
17+
$.mage.translate.add(['Hello World!', 'Bonjour tout le monde!']);
18+
expect('Hello World!').toEqual($.mage.translate.translate('Hello World!'));
19+
});
20+
it('works with one object as parameter', function () {
21+
var translation = {'Hello World!': 'Bonjour tout le monde!'};
22+
$.mage.translate.add(translation);
23+
expect(translation['Hello World!']).toEqual($.mage.translate.translate('Hello World!'));
24+
25+
translation = {
26+
'Hello World!': 'Hallo Welt!',
27+
'Some text with symbols!-+"%#*': 'Ein Text mit Symbolen!-+"%#*'
28+
};
29+
30+
$.mage.translate.add(translation);
31+
$.each(translation, function (key) {
32+
expect(translation[key]).toEqual($.mage.translate.translate(key));
33+
});
34+
});
35+
it('works with two string as parameter', function () {
36+
$.mage.translate.add('Hello World!', 'Bonjour tout le monde!');
37+
expect('Bonjour tout le monde!').toEqual($.mage.translate.translate('Hello World!'));
38+
});
39+
it('works with translation alias __', function () {
40+
$.mage.translate.add('Hello World!');
41+
expect('Hello World!').toEqual($.mage.__('Hello World!'));
42+
});
43+
});
44+
45+
});

0 commit comments

Comments
 (0)