diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html index ae77a0ad0..6c56e7424 100644 --- a/modules/travel/front/extra-community/index.html +++ b/modules/travel/front/extra-community/index.html @@ -22,7 +22,7 @@
- diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js index 08d4a168f..44527d45e 100644 --- a/modules/travel/front/extra-community/index.js +++ b/modules/travel/front/extra-community/index.js @@ -32,6 +32,14 @@ class Controller extends Section { }; } + get hasDateRange() { + const userParams = this.$.model.userParams; + const hasLanded = userParams.landedFrom || userParams.landedTo; + const hasShipped = userParams.shippedFrom || userParams.shippedTo; + + return hasLanded || hasShipped; + } + findDraggable($event) { const target = $event.target; const draggable = target.closest(this.draggableElement); diff --git a/modules/travel/front/extra-community/index.spec.js b/modules/travel/front/extra-community/index.spec.js index 7815bdd4f..59688a46c 100644 --- a/modules/travel/front/extra-community/index.spec.js +++ b/modules/travel/front/extra-community/index.spec.js @@ -14,6 +14,17 @@ describe('Travel Component vnTravelExtraCommunity', () => { controller.$.model.refresh = jest.fn(); })); + describe('hasDateRange()', () => { + it('should return truthy when shippedFrom or landedTo are set as userParams', () => { + const now = new Date(); + controller.$.model.userParams = {shippedFrom: now, landedTo: now}; + + const result = controller.hasDateRange; + + expect(result).toBeTruthy(); + }); + }); + describe('findDraggable()', () => { it('should find the draggable element', () => { const draggable = document.createElement('a');