Skip to content
Permalink
Browse files

update tests, fix a possible viewport issue when document is shorter …

…than window height
  • Loading branch information...
ganlanyuan committed Dec 10, 2018
1 parent c607dec commit 557d11606d0b61e62f4f4ffdfd5ff8ff0741ad11
Showing with 814 additions and 435 deletions.
  1. +4 −1 browserstack.conf.js
  2. +1 −1 dist/min/tiny-slider.js
  3. +1 −1 dist/sourcemaps/tiny-slider.css.map
  4. +1 −1 dist/sourcemaps/tiny-slider.js.map
  5. +1 −1 dist/tiny-slider.css
  6. +42 −45 dist/tiny-slider.js
  7. +8 −2 package.json
  8. +42 −45 src/tiny-slider.js
  9. +42 −45 src/tiny-slider.module.js
  10. +8 −0 src/tiny-slider.scss
  11. +20 −1 template/test/index.njk
  12. +7 −6 template/test/parts/layout.njk
  13. +1 −0 test/css/test.css
  14. +443 −186 test/index.html
  15. +1 −1 test/js/options.js
  16. BIN test/screenshot/chrome/autoHeight.png
  17. BIN test/screenshot/chrome/base.png
  18. BIN test/screenshot/chrome/center-autoWidth-loop-edgePadding.png
  19. BIN test/screenshot/chrome/center-autoWidth-loop.png
  20. BIN test/screenshot/chrome/center-autoWidth-non-loop-edgePadding.png
  21. BIN test/screenshot/chrome/center-autoWidth-non-loop.png
  22. BIN test/screenshot/chrome/center-fixedWidth-loop.png
  23. BIN test/screenshot/chrome/center-fixedWidth-non-loop.png
  24. BIN test/screenshot/chrome/center-lazyload-autoWidth-loop.png
  25. BIN test/screenshot/chrome/center-lazyload-autoWidth-non-loop.png
  26. BIN test/screenshot/chrome/center-lazyload-fixedWidth-loop.png
  27. BIN test/screenshot/chrome/center-lazyload-fixedWidth-non-loop.png
  28. BIN test/screenshot/chrome/center-lazyload-loop.png
  29. BIN test/screenshot/chrome/center-lazyload-non-loop.png
  30. BIN test/screenshot/chrome/center-loop.png
  31. BIN test/screenshot/chrome/center-non-loop.png
  32. BIN test/screenshot/chrome/customize.png
  33. BIN test/screenshot/chrome/fixedWidth-edgePadding-gutter.png
  34. BIN test/screenshot/chrome/fixedWidth-edgePadding.png
  35. BIN test/screenshot/chrome/fixedWidth.png
  36. BIN test/screenshot/chrome/non-loop.png
  37. BIN test/screenshot/chrome/slide-by-page.png
  38. BIN test/screenshot/edge/autoHeight.png
  39. BIN test/screenshot/edge/base.png
  40. BIN test/screenshot/edge/center-autoWidth-loop-edgePadding.png
  41. BIN test/screenshot/edge/center-autoWidth-loop.png
  42. BIN test/screenshot/edge/center-autoWidth-non-loop-edgePadding.png
  43. BIN test/screenshot/edge/center-autoWidth-non-loop.png
  44. BIN test/screenshot/edge/center-fixedWidth-loop.png
  45. BIN test/screenshot/edge/center-fixedWidth-non-loop.png
  46. BIN test/screenshot/edge/center-lazyload-autoWidth-loop.png
  47. BIN test/screenshot/edge/center-lazyload-autoWidth-non-loop.png
  48. BIN test/screenshot/edge/center-lazyload-fixedWidth-loop.png
  49. BIN test/screenshot/edge/center-lazyload-fixedWidth-non-loop.png
  50. BIN test/screenshot/edge/center-lazyload-loop.png
  51. BIN test/screenshot/edge/center-lazyload-non-loop.png
  52. BIN test/screenshot/edge/center-loop.png
  53. BIN test/screenshot/edge/center-non-loop.png
  54. BIN test/screenshot/edge/customize.png
  55. BIN test/screenshot/edge/fixedWidth.png
  56. BIN test/screenshot/edge/non-loop.png
  57. BIN test/screenshot/edge/slide-by-page.png
  58. BIN test/screenshot/edge/start-index.png
  59. BIN test/screenshot/firefox/autoHeight.png
  60. BIN test/screenshot/firefox/base.png
  61. BIN test/screenshot/firefox/center-autoWidth-loop-edgePadding.png
  62. BIN test/screenshot/firefox/center-autoWidth-loop.png
  63. BIN test/screenshot/firefox/center-autoWidth-non-loop-edgePadding.png
  64. BIN test/screenshot/firefox/center-autoWidth-non-loop.png
  65. BIN test/screenshot/firefox/center-fixedWidth-loop.png
  66. BIN test/screenshot/firefox/center-fixedWidth-non-loop.png
  67. BIN test/screenshot/firefox/center-lazyload-autoWidth-loop.png
  68. BIN test/screenshot/firefox/center-lazyload-autoWidth-non-loop.png
  69. BIN test/screenshot/firefox/center-lazyload-fixedWidth-loop.png
  70. BIN test/screenshot/firefox/center-lazyload-fixedWidth-non-loop.png
  71. BIN test/screenshot/firefox/center-lazyload-loop.png
  72. BIN test/screenshot/firefox/center-lazyload-non-loop.png
  73. BIN test/screenshot/firefox/center-loop.png
  74. BIN test/screenshot/firefox/center-non-loop.png
  75. BIN test/screenshot/firefox/customize.png
  76. BIN test/screenshot/firefox/fixedWidth.png
  77. BIN test/screenshot/firefox/non-loop.png
  78. BIN test/screenshot/firefox/slide-by-page.png
  79. BIN test/screenshot/ie/autoHeight.png
  80. BIN test/screenshot/ie/base.png
  81. BIN test/screenshot/ie/center-autoWidth-loop-edgePadding.png
  82. BIN test/screenshot/ie/center-autoWidth-loop.png
  83. BIN test/screenshot/ie/center-autoWidth-non-loop-edgePadding.png
  84. BIN test/screenshot/ie/center-autoWidth-non-loop.png
  85. BIN test/screenshot/ie/center-fixedWidth-loop.png
  86. BIN test/screenshot/ie/center-fixedWidth-non-loop.png
  87. BIN test/screenshot/ie/center-lazyload-autoWidth-loop.png
  88. BIN test/screenshot/ie/center-lazyload-autoWidth-non-loop.png
  89. BIN test/screenshot/ie/center-lazyload-fixedWidth-loop.png
  90. BIN test/screenshot/ie/center-lazyload-fixedWidth-non-loop.png
  91. BIN test/screenshot/ie/center-lazyload-loop.png
  92. BIN test/screenshot/ie/center-lazyload-non-loop.png
  93. BIN test/screenshot/ie/center-loop.png
  94. BIN test/screenshot/ie/center-non-loop.png
  95. BIN test/screenshot/ie/customize.png
  96. BIN test/screenshot/ie/fixedWidth-edgePadding-gutter.png
  97. BIN test/screenshot/ie/fixedWidth-edgePadding.png
  98. BIN test/screenshot/ie/fixedWidth.png
  99. BIN test/screenshot/ie/non-loop.png
  100. BIN test/screenshot/ie/slide-by-page.png
  101. BIN test/screenshot/opera/autoHeight.png
  102. BIN test/screenshot/opera/base.png
  103. BIN test/screenshot/opera/center-autoWidth-loop-edgePadding.png
  104. BIN test/screenshot/opera/center-autoWidth-loop.png
  105. BIN test/screenshot/opera/center-autoWidth-non-loop-edgePadding.png
  106. BIN test/screenshot/opera/center-autoWidth-non-loop.png
  107. BIN test/screenshot/opera/center-fixedWidth-loop.png
  108. BIN test/screenshot/opera/center-fixedWidth-non-loop.png
  109. BIN test/screenshot/opera/center-lazyload-autoWidth-loop.png
  110. BIN test/screenshot/opera/center-lazyload-autoWidth-non-loop.png
  111. BIN test/screenshot/opera/center-lazyload-fixedWidth-loop.png
  112. BIN test/screenshot/opera/center-lazyload-fixedWidth-non-loop.png
  113. BIN test/screenshot/opera/center-lazyload-loop.png
  114. BIN test/screenshot/opera/center-lazyload-non-loop.png
  115. BIN test/screenshot/opera/center-loop.png
  116. BIN test/screenshot/opera/center-non-loop.png
  117. BIN test/screenshot/opera/customize.png
  118. BIN test/screenshot/opera/fixedWidth.png
  119. BIN test/screenshot/opera/non-loop.png
  120. BIN test/screenshot/opera/slide-by-page.png
  121. BIN test/screenshot/safari/autoHeight.png
  122. BIN test/screenshot/safari/base.png
  123. BIN test/screenshot/safari/center-autoWidth-loop-edgePadding.png
  124. BIN test/screenshot/safari/center-autoWidth-loop.png
  125. BIN test/screenshot/safari/center-autoWidth-non-loop-edgePadding.png
  126. BIN test/screenshot/safari/center-autoWidth-non-loop.png
  127. BIN test/screenshot/safari/center-fixedWidth-loop.png
  128. BIN test/screenshot/safari/center-fixedWidth-non-loop.png
  129. BIN test/screenshot/safari/center-lazyload-autoWidth-loop.png
  130. BIN test/screenshot/safari/center-lazyload-autoWidth-non-loop.png
  131. BIN test/screenshot/safari/center-lazyload-fixedWidth-loop.png
  132. BIN test/screenshot/safari/center-lazyload-fixedWidth-non-loop.png
  133. BIN test/screenshot/safari/center-lazyload-loop.png
  134. BIN test/screenshot/safari/center-lazyload-non-loop.png
  135. BIN test/screenshot/safari/center-loop.png
  136. BIN test/screenshot/safari/center-non-loop.png
  137. BIN test/screenshot/safari/customize.png
  138. BIN test/screenshot/safari/fixedWidth-edgePadding-gutter.png
  139. BIN test/screenshot/safari/fixedWidth-edgePadding.png
  140. BIN test/screenshot/safari/fixedWidth.png
  141. BIN test/screenshot/safari/non-loop.png
  142. BIN test/screenshot/safari/slide-by-page.png
  143. +192 −99 test/scripts/screenshot.js
@@ -86,7 +86,10 @@ for(var i in nightwatch_config.test_settings){
config['selenium_host'] = nightwatch_config.selenium.host;
config['selenium_port'] = nightwatch_config.selenium.port;
config['desiredCapabilities'] = config['desiredCapabilities'] || {};
config['globals'] = { 'browser_name': browser_name };
config['globals'] = {
'browser_name': browser_name,
'abortOnAssertionFailure': false
};
for(var j in nightwatch_config.common_capabilities){
config['desiredCapabilities'][j] = config['desiredCapabilities'][j] || nightwatch_config.common_capabilities[j];
// config['desiredCapabilities']['browserstack.local'] = true;

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more.

@@ -687,6 +687,7 @@ var tns = function(options) {
windowWidth = getWindowWidth(),
isOn = false;
if (responsive) { setBreakpointZone(); }
if (carousel) { container.className += ' tns-vpfix'; }

// fixedWidth: viewport > rightBoundary > indexMax
var autoWidth = options.autoWidth,
@@ -879,7 +880,10 @@ var tns = function(options) {

}

sliderInit();
if (carousel) { container.className = container.className.replace('tns-vpfix', ''); }
initStructure();
initSheet();
initSliderTransform();

// === COMMON FUNCTIONS === //
function resetVariblesWhenDisable (condition) {
@@ -1101,9 +1105,43 @@ var tns = function(options) {
return getCSSPrefix(ANIMATIONDURATION, 17) + 'animation-duration:' + speed / 1000 + 's;';
}

function sliderInit () {
if (responsive) { setBreakpointZone(); }
initStructure();
function initStructure () {
var classOuter = 'tns-outer',
classInner = 'tns-inner',
hasGutter = hasOption('gutter');

outerWrapper.className = classOuter;
innerWrapper.className = classInner;
outerWrapper.id = slideId + '-ow';
innerWrapper.id = slideId + '-iw';

// set container properties
if (container.id === '') { container.id = slideId; }
newContainerClasses += PERCENTAGELAYOUT || autoWidth ? ' tns-subpixel' : ' tns-no-subpixel';
newContainerClasses += CALC ? ' tns-calc' : ' tns-no-calc';
if (autoWidth) { newContainerClasses += ' tns-autowidth'; }
newContainerClasses += ' tns-' + options.axis;
container.className += newContainerClasses;

// add constrain layer for carousel
if (carousel) {
middleWrapper = doc.createElement('div');
middleWrapper.id = slideId + '-mw';
middleWrapper.className = 'tns-ovh';

outerWrapper.appendChild(middleWrapper);
middleWrapper.appendChild(innerWrapper);
} else {
outerWrapper.appendChild(innerWrapper);
}

if (autoHeight) {
var wp = middleWrapper ? middleWrapper : innerWrapper;
wp.className += ' tns-ah';
}

containerParent.insertBefore(outerWrapper, container);
innerWrapper.appendChild(container);

// add id, class, aria attributes
// before clone slides
@@ -1142,47 +1180,6 @@ var tns = function(options) {
slideItems = container.children;
}

initSheet();
initSliderTransform();
}

function initStructure () {
var classOuter = 'tns-outer',
classInner = 'tns-inner',
hasGutter = hasOption('gutter');

outerWrapper.className = classOuter;
innerWrapper.className = classInner;
outerWrapper.id = slideId + '-ow';
innerWrapper.id = slideId + '-iw';

// set container properties
if (container.id === '') { container.id = slideId; }
newContainerClasses += PERCENTAGELAYOUT || autoWidth ? ' tns-subpixel' : ' tns-no-subpixel';
newContainerClasses += CALC ? ' tns-calc' : ' tns-no-calc';
if (autoWidth) { newContainerClasses += ' tns-autowidth'; }
newContainerClasses += ' tns-' + options.axis;
container.className += newContainerClasses;

// add constrain layer for carousel
if (carousel) {
middleWrapper = doc.createElement('div');
middleWrapper.id = slideId + '-mw';
middleWrapper.className = 'tns-ovh';

outerWrapper.appendChild(middleWrapper);
middleWrapper.appendChild(innerWrapper);
} else {
outerWrapper.appendChild(innerWrapper);
}

if (autoHeight) {
var wp = middleWrapper ? middleWrapper : innerWrapper;
wp.className += ' tns-ah';
}

containerParent.insertBefore(outerWrapper, container);
innerWrapper.appendChild(container);
}

function initSliderTransform () {

0 comments on commit 557d116

Please sign in to comment.
You can’t perform that action at this time.