This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nemanja Popovic
committed
Nov 6, 2015
1 parent
f2a6afd
commit e92bcb7
Showing
12 changed files
with
458 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
public/js/app/home/directives/site-content-image-directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* [y] hybris Platform | ||
* | ||
* Copyright (c) 2000-2015 hybris AG | ||
* All rights reserved. | ||
* | ||
* This software is the confidential and proprietary information of hybris | ||
* ("Confidential Information"). You shall not disclose such Confidential | ||
* Information and shall use it only in accordance with the terms of the | ||
* license agreement you entered into with hybris. | ||
*/ | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
angular.module('ds.home') | ||
.directive('siteContentImage', function () { | ||
return { | ||
restrict: 'E', | ||
scope: { | ||
image: '=', | ||
id: '@imageId' | ||
}, | ||
templateUrl: 'js/app/home/templates/site-content-image.html' | ||
}; | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* [y] hybris Platform | ||
* | ||
* Copyright (c) 2000-2015 hybris AG | ||
* All rights reserved. | ||
* | ||
* This software is the confidential and proprietary information of hybris | ||
* ("Confidential Information"). You shall not disclose such Confidential | ||
* Information and shall use it only in accordance with the terms of the | ||
* license agreement you entered into with hybris. | ||
*/ | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
angular.module('ds.home') | ||
.service('HomeSvc', ['GlobalData', 'settings', '$state', | ||
function (GlobalData, settings, $state) { | ||
|
||
var homeBannerId = 'homeBanner'; | ||
|
||
/** | ||
* Initializes all site content in objects that can be used in UI | ||
* @return object that contains carousel images and banners | ||
*/ | ||
var init = function init() { | ||
var self = this; | ||
var slidesLarge = []; | ||
var slidesSmall = []; | ||
var banner1 = {}; | ||
var banner2 = {}; | ||
var siteContent = GlobalData.getSiteBanners(); | ||
|
||
if (self.siteContentExists(siteContent)) { | ||
if (!!siteContent.topImages && siteContent.topImages.length > 0) { | ||
|
||
for (var i = 0; i < siteContent.topImages.length; i++) { | ||
if (!!siteContent.topImages[i].large && siteContent.topImages[i].large.imageUrl !== '') { | ||
slidesLarge.push({ id: homeBannerId, image: siteContent.topImages[i].large }); | ||
} | ||
|
||
if (!!siteContent.topImages[i].small && siteContent.topImages[i].small.imageUrl !== '') { | ||
slidesSmall.push({ id: homeBannerId, image: siteContent.topImages[i].small }); | ||
} | ||
} | ||
} | ||
banner1 = siteContent.banner1; | ||
banner2 = siteContent.banner2; | ||
} | ||
else { | ||
//Redirect to all products page | ||
$state.go(settings.allProductsState); | ||
} | ||
|
||
return { | ||
slidesLarge: slidesLarge, | ||
slidesSmall: slidesSmall, | ||
banner1: banner1, | ||
banner2: banner2 | ||
}; | ||
}; | ||
|
||
/** | ||
* Checks if there is any site content defined for selected site | ||
* @param siteContent - current site content | ||
* @return true/false value that shows if there is site content for provided site | ||
*/ | ||
var siteContentExists = function siteContentExists(siteContent) { | ||
if (!siteContent) { | ||
return false; | ||
} | ||
|
||
if (!!siteContent.topImages) { | ||
for (var i = 0; i < siteContent.topImages.length; i++) { | ||
if (!!siteContent.topImages[i] && | ||
!!siteContent.topImages[i].large && | ||
(siteContent.topImages[i].large.imageUrl !== '' || | ||
siteContent.topImages[i].small.imageUrl !== '')) { | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
if (!!siteContent.banner1 && | ||
!!siteContent.banner1.large && | ||
(siteContent.banner1.large.imageUrl !== '' || | ||
siteContent.banner1.small.imageUrl !== '')) { | ||
return true; | ||
} | ||
|
||
if (!!siteContent.banner2 && !! | ||
!!siteContent.banner2.large && | ||
(siteContent.banner2.large.imageUrl !== '' || | ||
siteContent.banner2.small.imageUrl !== '')) { | ||
return true; | ||
} | ||
|
||
return false; | ||
}; | ||
|
||
return { | ||
init: init, | ||
siteContentExists: siteContentExists | ||
}; | ||
|
||
}]); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
| ||
<div ng-if="image.hyperlinkUrl !== ''"> | ||
<a ng-if="image.internal" href="{{image.hyperlinkUrl}}"> | ||
<img ng-src="{{image.imageUrl}}" id="{{id}}" class="banner" /> | ||
</a> | ||
<a ng-if="!image.internal" href="{{image.hyperlinkUrl}}" target="_blank"> | ||
<img ng-src="{{image.imageUrl}}" id="{{id}}" class="banner" /> | ||
</a> | ||
</div> | ||
<img ng-if="image.hyperlinkUrl === ''" ng-src="{{image.imageUrl}}" id="{{id}}" class="banner" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,13 +58,12 @@ describe('coupons:', function () { | |
it('should not allow user to add coupon if not logged in', function () { | ||
tu.loadProductIntoCart('1', '$14.92'); | ||
tu.clickElement('linkText', 'ADD COUPON CODE'); | ||
tu.sendKeys('id', 'coupon-code', '10PERCENT'); | ||
tu.sendKeys('id', 'coupon-code', 'SIGNEDIN'); | ||
tu.clickElement('id', 'apply-coupon'); | ||
expect(element(by.binding('couponErrorMessage')).getText()).toEqual('SIGN IN TO USE COUPON CODE'); | ||
}); | ||
|
||
it('should not allow user to add coupon below minimum on cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
tu.loadProductIntoCart('1', '$14.92'); | ||
tu.clickElement('linkText', 'ADD COUPON CODE'); | ||
tu.sendKeys('id', 'coupon-code', '20MINIMUM'); | ||
|
@@ -76,7 +75,6 @@ describe('coupons:', function () { | |
}); | ||
|
||
it('should not allow user to add coupon with incorrect currency', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
browser.wait(function () { | ||
return element(by.xpath(tu.whiteCoffeeMug)).isPresent(); | ||
}); | ||
|
@@ -110,23 +108,20 @@ describe('coupons:', function () { | |
}); | ||
|
||
it('should add percentage off coupon on cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('10PERCENT', '$14.92'); | ||
verifyCartDetails('1', '$13.77', '-$1.07'); | ||
tu.clickElement('id', 'remove-coupon'); | ||
removeFromCart(); | ||
}); | ||
|
||
it('should add dollar off coupon on cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('10DOLLAR', '$14.92'); | ||
verifyCartDetails('1', '$4.22', '-$10.00'); | ||
tu.clickElement('id', 'remove-coupon'); | ||
removeFromCart(); | ||
}); | ||
|
||
it('update coupon totals when item is added and removed from cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('10PERCENT', '$14.92'); | ||
verifyCartDetails('1', '$13.77', '-$1.07'); | ||
tu.clickElement('id', 'continue-shopping'); | ||
|
@@ -157,7 +152,6 @@ describe('coupons:', function () { | |
}); | ||
|
||
it('should update coupon totals when quantity is changed', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('10PERCENT', '$14.92'); | ||
verifyCartDetails('1', '$13.77', '-$1.07'); | ||
tu.sendKeys('xpath', tu.cartQuantity, '5'); | ||
|
@@ -169,7 +163,6 @@ describe('coupons:', function () { | |
}); | ||
|
||
it('should remove coupon on cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('10PERCENT', '$14.92'); | ||
verifyCartDetails('1', '$13.77', '-$1.07'); | ||
tu.clickElement('id', 'remove-coupon') | ||
|
@@ -179,7 +172,6 @@ describe('coupons:', function () { | |
}); | ||
|
||
it('should not allow user to use expired coupon on cart', function () { | ||
tu.loginHelper('[email protected]', 'password'); | ||
addProductandApplyCoupon('EXPIRED', '$14.92'); | ||
expect(element(by.binding('couponErrorMessage')).getText()).toEqual('COUPON HAS EXPIRED.'); | ||
removeFromCart(); | ||
|
Oops, something went wrong.