Skip to content

Commit

Permalink
e2e against "cloud", minor change for IE
Browse files Browse the repository at this point in the history
  • Loading branch information
SquadraCorse committed Aug 24, 2014
1 parent 8a2d191 commit aafd92b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
1 change: 0 additions & 1 deletion config/grunt/aliases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test:
- 'karma:unit'

e2eSauce:
- 'connect:test'
- 'protractor:sauce'

e2eChrome:
Expand Down
1 change: 1 addition & 0 deletions config/protractor-chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports.config = {
chromeOnly: true,

baseUrl: 'http://localhost:8000/',
// baseUrl: 'http://afklm.github.io/ng-lazy-image/',

framework: 'jasmine',

Expand Down
4 changes: 2 additions & 2 deletions config/protractor-sauce.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.config = {
'name': 'AFKL-LAZY-IMAGE CHROME OSX ' + process.env.TRAVIS_BUILD_NUMBER
}/*, {
'browserName': 'internet explorer',
'platform': 'Windows 8',
'platform': 'ANY',
'version': '10',
'ignoreProtectedModeSettings': true,
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
Expand All @@ -27,7 +27,7 @@ exports.config = {
'../test/e2e/*.js'
],

baseUrl: 'http://localhost:8000/',
baseUrl: 'http://afklm.github.io/ng-lazy-image/',

framework: 'jasmine',

Expand Down
20 changes: 14 additions & 6 deletions dist/lazy-image.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global angular */
angular.module('afkl.lazyImage', [])
.service('afklSrcSetService', ['$window', function($window) {
.service('afklSrcSetService', ['$window', '$document', function($window, $document) {
'use strict';

/**
Expand Down Expand Up @@ -106,9 +106,9 @@ angular.module('afkl.lazyImage', [])
if (!imageCandidates) { return; }
if (!view) {
view = {
'w' : $window.innerWidth,
'h' : $window.innerHeight,
'x' : $window.devicePixelRatio
'w' : $window.innerWidth || $document[0].documentElement.clientWidth,
'h' : $window.innerHeight || $document[0].documentElement.clientHeight,
'x' : $window.devicePixelRatio || 1
};
}

Expand Down Expand Up @@ -294,7 +294,7 @@ angular.module('afkl.lazyImage', [])


}])
.directive('afklLazyImage', ['$window', '$timeout', 'afklSrcSetService', function ($window, $timeout, srcSetService) {
.directive('afklLazyImage', ['$window', '$document', '$timeout', 'afklSrcSetService', function ($window, $document, $timeout, srcSetService) {
'use strict';

// Use srcSetService to find out our best available image
Expand Down Expand Up @@ -370,7 +370,15 @@ angular.module('afkl.lazyImage', [])
// Config vars
var remaining, shouldLoad, windowBottom;

windowBottom = $window[0].innerHeight + $window[0].scrollY;
var height = "innerHeight" in $window[0] ?
$window[0].innerHeight
: $document[0].documentElement.clientHeight;

var scroll = "scrollY" in $window[0] ?
$window[0].scrollY
: document[0].documentElement.scrollTop;

windowBottom = height + scroll;
remaining = offsetElement - windowBottom;

// Is our top of our image container in bottom of our viewport?
Expand Down
2 changes: 1 addition & 1 deletion dist/lazy-image.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions src/lazy-image.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global angular */
angular.module('afkl.lazyImage', [])
.service('afklSrcSetService', ['$window', function($window) {
.service('afklSrcSetService', ['$window', '$document', function($window, $document) {
'use strict';

/**
Expand Down Expand Up @@ -106,9 +106,9 @@ angular.module('afkl.lazyImage', [])
if (!imageCandidates) { return; }
if (!view) {
view = {
'w' : $window.innerWidth,
'h' : $window.innerHeight,
'x' : $window.devicePixelRatio
'w' : $window.innerWidth || $document[0].documentElement.clientWidth,
'h' : $window.innerHeight || $document[0].documentElement.clientHeight,
'x' : $window.devicePixelRatio || 1
};
}

Expand Down Expand Up @@ -294,7 +294,7 @@ angular.module('afkl.lazyImage', [])


}])
.directive('afklLazyImage', ['$window', '$timeout', 'afklSrcSetService', function ($window, $timeout, srcSetService) {
.directive('afklLazyImage', ['$window', '$document', '$timeout', 'afklSrcSetService', function ($window, $document, $timeout, srcSetService) {
'use strict';

// Use srcSetService to find out our best available image
Expand Down Expand Up @@ -370,7 +370,15 @@ angular.module('afkl.lazyImage', [])
// Config vars
var remaining, shouldLoad, windowBottom;

windowBottom = $window[0].innerHeight + $window[0].scrollY;
var height = "innerHeight" in $window[0] ?
$window[0].innerHeight
: $document[0].documentElement.clientHeight;

var scroll = "scrollY" in $window[0] ?
$window[0].scrollY
: document[0].documentElement.scrollTop;

windowBottom = height + scroll;
remaining = offsetElement - windowBottom;

// Is our top of our image container in bottom of our viewport?
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

describe('Viewports:', function () {

browser.get('/');
browser.get('index.html');

it('Do we get desktop image, and does url update on resize', function () {
browser.manage().window().setSize(1024, 768);
Expand Down

0 comments on commit aafd92b

Please sign in to comment.