Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
EZP-26872: universaldiscoveryview test part2
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaneDiot committed Feb 8, 2017
1 parent 0727921 commit 2938160
Showing 1 changed file with 63 additions and 3 deletions.
66 changes: 63 additions & 3 deletions Tests/js/views/assets/ez-universaldiscoveryview-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ YUI.add('ez-universaldiscoveryview-tests', function (Y) {
this.method2._set("identifier", "method2");

this.confirmedList = new Y.View();
this.startingLocation = {};
this.startingLocationId = '42';
this.virtualRootLocation = {};

this.view = new Y.eZ.UniversalDiscoveryView({
container: '.container',
Expand Down Expand Up @@ -563,6 +566,10 @@ YUI.add('ez-universaldiscoveryview-tests', function (Y) {
var method2 = this.method2,
method1 = this.method1;

this.view.set('startingLocation', this.startingLocation);
this.view.set('startingLocationId', this.startingLocationId);
this.view.set('virtualRootLocation', this.virtualRootLocation);

this.view.set('active', true);
this.view.set('visibleMethod', 'method2');

Expand All @@ -572,15 +579,31 @@ YUI.add('ez-universaldiscoveryview-tests', function (Y) {
);
Assert.isFalse(
method1.get('visible'),
"The method2 should not be visible"
"The method1 should not be visible"
);

Assert.areSame(
method2.get('startingLocation'), this.startingLocation,
"method should have been updated with startingLocation"
);

Assert.areSame(
method2.get('startingLocationId'), this.startingLocationId,
"method should have been updated with startingLocationId"
);

Assert.areSame(
method2.get('virtualRootLocation'), this.virtualRootLocation,
"method should have been updated with virtualRootLocation"
);

Assert.isTrue(
method2.get('multiple'),
"The method2 mutiple flag should be true"
"The method2 multiple flag should be true"
);
Assert.isTrue(
method1.get('multiple'),
"The method1 mutiple flag should be true"
"The method1 multiple flag should be true"
);
},

Expand Down Expand Up @@ -683,6 +706,43 @@ YUI.add('ez-universaldiscoveryview-tests', function (Y) {
);
},

"Should instantiate the search method": function () {
var methods = this.view.get('methods');

Assert.isArray(
methods,
"The method list should be an array"
);
Assert.areEqual(
2, methods.length,
"The default method list should contain 2 elements"
);
Assert.isInstanceOf(
Y.eZ.UniversalDiscoverySearchView, methods[1],
"The first element should be an instance of the search method"
);
Assert.areSame(
this.multiple, methods[1].get('multiple'),
"The selection mode should be passed to the method views"
);
Assert.isFunction(
methods[1].get('isAlreadySelected'),
"The isAlreadySelected function should be passed to the method views"
);
Assert.areSame(
this.startingLocationId, methods[1].get('startingLocationId'),
"The startingLocationId should be passed to the method views"
);
Assert.areSame(
this.startingLocation, methods[1].get('startingLocation'),
"The startingLocation should be passed to the method views"
);
Assert.areSame(
this.virtualRootLocation, methods[1].get('virtualRootLocation'),
"The virtualRootLocation should be passed to the method views"
);
},

"Should add the universal discovery view as a bubble target": function () {
var methods = this.view.get('methods'),
bubble = false;
Expand Down

0 comments on commit 2938160

Please # to comment.