{{/each}}
diff --git a/Resources/translations/locationview.en.xlf b/Resources/translations/locationview.en.xlf
index 177053e90..c65ce3e8d 100644
--- a/Resources/translations/locationview.en.xlf
+++ b/Resources/translations/locationview.en.xlf
@@ -1,6 +1,6 @@
-
+ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
@@ -518,6 +518,12 @@
key: locationview.versions.remove.selected.archived.versionResources/public/templates/tabs/versions.hbt
+
+
+ restore
+ key: locationview.versions.restore
+ Resources/public/templates/tabs/versions.hbt
+ Version
diff --git a/Tests/js/models/assets/ez-versioninfomodel-tests.js b/Tests/js/models/assets/ez-versioninfomodel-tests.js
index 429ea2357..a9a632223 100644
--- a/Tests/js/models/assets/ez-versioninfomodel-tests.js
+++ b/Tests/js/models/assets/ez-versioninfomodel-tests.js
@@ -3,7 +3,7 @@
* For full copyright and license information view LICENSE file distributed with this source code.
*/
YUI.add('ez-versioninfomodel-tests', function (Y) {
- var loadFromHashTest, removeTest,
+ var loadFromHashTest, removeTest, languageCodeListTest,
Assert = Y.Assert;
loadFromHashTest = new Y.Test.Case({
@@ -244,8 +244,55 @@ YUI.add('ez-versioninfomodel-tests', function (Y) {
},
});
+ languageCodeListTest = new Y.Test.Case({
+ name: "eZ Version Model languageCodeList attribute tests",
+
+ setUp: function () {
+ this.version = new Y.eZ.VersionInfo();
+ },
+
+ tearDown: function () {
+ this.version.destroy();
+ delete this.version;
+ },
+
+ "Should return the languages as an array": function () {
+ var languages = ['fre-FR', 'eng-GB'],
+ list;
+
+ this.version.set('languageCodes', languages.join(','));
+ list = this.version.get('languageCodeList');
+
+ Assert.isArray(
+ list,
+ "The list should be an array"
+ );
+ Assert.areEqual(
+ languages.length, list.length,
+ "The list should contain the language codes"
+ );
+ Y.Array.each(list, function (lang, i) {
+ Assert.areEqual(languages[i], lang);
+ });
+ },
+
+ "Should return an empty array": function () {
+ var list = this.version.get('languageCodeList');
+
+ Assert.isArray(
+ list,
+ "The list should be an array"
+ );
+ Assert.areEqual(
+ 0, list.length,
+ "The list should be an empty array"
+ );
+ },
+
+ });
+
Y.Test.Runner.setName("eZ Version Info Model tests");
Y.Test.Runner.add(loadFromHashTest);
Y.Test.Runner.add(removeTest);
-
+ Y.Test.Runner.add(languageCodeListTest);
}, '', {requires: ['test', 'json', 'model-tests', 'ez-versioninfomodel', 'ez-restmodel']});
diff --git a/Tests/js/views/tabs/assets/ez-locationviewversionstabview-tests.js b/Tests/js/views/tabs/assets/ez-locationviewversionstabview-tests.js
index 84228804a..7295eadcf 100644
--- a/Tests/js/views/tabs/assets/ez-locationviewversionstabview-tests.js
+++ b/Tests/js/views/tabs/assets/ez-locationviewversionstabview-tests.js
@@ -11,6 +11,7 @@ YUI.add('ez-locationviewversionstabview-tests', function (Y) {
fireEditVersionEventTest,
selectArchivedVersionTest,
selectDeleteDraftVersionTest,
+ restoreVersionInLanguageTest,
Assert = Y.Assert,
Mock = Y.Mock,
createCheckableVersionMock = function (versionId, versionNo, checked) {
@@ -759,6 +760,45 @@ YUI.add('ez-locationviewversionstabview-tests', function (Y) {
},
});
+ restoreVersionInLanguageTest = new Y.Test.Case({
+ name: "ViewVersionsTabView restore version in language test",
+ setUp: function () {
+ this.contentMock = new Mock();
+
+ this.view = new Y.eZ.LocationViewVersionsTabView({
+ content: {},
+ container: '.container',
+ });
+ this.view.render();
+ },
+
+ tearDown: function () {
+ this.view.destroy();
+ delete this.view;
+ },
+
+ "Should fire the `restoreVersionInLanguage` event": function () {
+ var link = this.view.get('container').one('.ez-version-in-language-restore');
+
+ this.view.on('restoreVersionInLanguage', this.next(function (e) {
+ Assert.areSame(
+ this.view.get('content'), e.content,
+ "The content should be provided"
+ );
+ Assert.areEqual(
+ link.getAttribute('data-version'), e.versionNo,
+ "The version number should be provided"
+ );
+ Assert.areEqual(
+ link.getAttribute('data-version-language-code'), e.languageCode,
+ "The language code should be provided"
+ );
+ }, this));
+ link.simulateGesture('tap');
+ this.wait();
+ },
+ });
+
Y.Test.Runner.setName("eZ Location View Versions Tab View tests");
Y.Test.Runner.add(attributesTest);
Y.Test.Runner.add(renderTest);
@@ -768,4 +808,5 @@ YUI.add('ez-locationviewversionstabview-tests', function (Y) {
Y.Test.Runner.add(selectDeleteDraftVersionTest);
Y.Test.Runner.add(fireDeleteVersionEventTest);
Y.Test.Runner.add(fireEditVersionEventTest);
+ Y.Test.Runner.add(restoreVersionInLanguageTest);
}, '', {requires: ['test', 'ez-locationviewversionstabview', 'node-event-simulate']});
diff --git a/Tests/js/views/tabs/ez-locationviewversionstabview.html b/Tests/js/views/tabs/ez-locationviewversionstabview.html
index 88e17c0b5..af90c43a3 100644
--- a/Tests/js/views/tabs/ez-locationviewversionstabview.html
+++ b/Tests/js/views/tabs/ez-locationviewversionstabview.html
@@ -43,6 +43,7 @@
{{/each}}
+ restore