Skip to content

Commit

Permalink
fix(e2e): initSwiper
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Feb 23, 2021
1 parent 8fa6d64 commit 9915f8b
Showing 1 changed file with 43 additions and 45 deletions.
88 changes: 43 additions & 45 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,51 +75,49 @@ Cypress.Commands.add(
}
</div>
`;
setTimeout(() => {
// eslint-disable-next-line dot-notation
const _config = config;
if (config.navigation === true) {
_config.navigation = {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
hideOnClick: false,
disabledClass: 'swiper-button-disabled',
hiddenClass: 'swiper-button-hidden',
lockClass: 'swiper-button-lock',
};
}
if (config.pagination === true) {
_config.pagination = {
el: '.swiper-pagination',
bulletElement: 'span',
clickable: true,
hideOnClick: false,
renderBullet: null,
renderProgressbar: null,
renderFraction: null,
renderCustom: null,
progressbarOpposite: false,
type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom'
dynamicBullets: false,
dynamicMainBullets: 1,
formatFractionCurrent: (number) => number,
formatFractionTotal: (number) => number,
bulletClass: 'swiper-pagination-bullet',
bulletActiveClass: 'swiper-pagination-bullet-active',
modifierClass: 'swiper-pagination-', // NEW
currentClass: 'swiper-pagination-current',
totalClass: 'swiper-pagination-total',
hiddenClass: 'swiper-pagination-hidden',
progressbarFillClass: 'swiper-pagination-progressbar-fill',
progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
clickableClass: 'swiper-pagination-clickable', // NEW
lockClass: 'swiper-pagination-lock',
};
}
_window.swiperRef = new _window.Swiper(el, _config);
console.log(_window.swiperRef);
return _window.swiperRef;
});
// eslint-disable-next-line dot-notation
const _config = config;
if (config.navigation === true) {
_config.navigation = {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
hideOnClick: false,
disabledClass: 'swiper-button-disabled',
hiddenClass: 'swiper-button-hidden',
lockClass: 'swiper-button-lock',
};
}
if (config.pagination === true) {
_config.pagination = {
el: '.swiper-pagination',
bulletElement: 'span',
clickable: true,
hideOnClick: false,
renderBullet: null,
renderProgressbar: null,
renderFraction: null,
renderCustom: null,
progressbarOpposite: false,
type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom'
dynamicBullets: false,
dynamicMainBullets: 1,
formatFractionCurrent: (number) => number,
formatFractionTotal: (number) => number,
bulletClass: 'swiper-pagination-bullet',
bulletActiveClass: 'swiper-pagination-bullet-active',
modifierClass: 'swiper-pagination-', // NEW
currentClass: 'swiper-pagination-current',
totalClass: 'swiper-pagination-total',
hiddenClass: 'swiper-pagination-hidden',
progressbarFillClass: 'swiper-pagination-progressbar-fill',
progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',
clickableClass: 'swiper-pagination-clickable', // NEW
lockClass: 'swiper-pagination-lock',
};
}
_window.swiperRef = new _window.Swiper(el, _config);
console.log(_window.swiperRef);
return _window.swiperRef;
});
},
);
Expand Down

0 comments on commit 9915f8b

Please sign in to comment.