Skip to content

Commit ad8002c

Browse files
committed
feat: rename swiper-container class to swiper
1 parent c763c9c commit ad8002c

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

cypress/integration/modules/a11y.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ context('Core', () => {
4040
cy.getSlide(9).should('have.attr', 'aria-label', '10 of 10');
4141
});
4242

43-
it('should add aria-roledescription="slide" to swiper-container', () => {
43+
it('should add aria-roledescription="slide" to swiper container', () => {
4444
cy.initSwiper({
4545
a11y: { containerRoleDescriptionMessage: 'test' },
4646
});

cypress/integration/modules/core.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ context('Core', () => {
2020
autoHeight: true,
2121
});
2222
cy.injectStyles(`
23-
.swiper-container .swiper-slide {
23+
.swiper .swiper-slide {
2424
height: 300px;
2525
line-height: 300px;
2626
}
2727
28-
.swiper-container .swiper-slide:nth-child(2n) {
28+
.swiper .swiper-slide:nth-child(2n) {
2929
height: 500px;
3030
line-height: 500px;
3131
}`);
@@ -103,7 +103,7 @@ context('Core', () => {
103103

104104
it('slidesPerView auto', () => {
105105
cy.injectStyles(`
106-
.swiper-container {
106+
.swiper {
107107
width: 100%;
108108
height: 100%;
109109
}
@@ -194,7 +194,7 @@ context('Core', () => {
194194
containerModifierClass: 'unique-test-',
195195
});
196196
cy.get('.unique-test-horizontal').should('exist');
197-
cy.get('.swiper-container-horizontal').should('not.exist');
197+
cy.get('.swiper-horizontal').should('not.exist');
198198
});
199199

200200
it('slideActiveClass', () => {
@@ -314,13 +314,13 @@ context('Core', () => {
314314

315315
it('direction horizontal', () => {
316316
cy.initSwiper(); // check default
317-
cy.get('.swiper-container-horizontal').should('exist');
318-
cy.get('.swiper-container-vertical').should('not.exist');
317+
cy.get('.swiper-horizontal').should('exist');
318+
cy.get('.swiper-vertical').should('not.exist');
319319
cy.reinitSwiper({
320320
direction: 'horizontal',
321321
});
322-
cy.get('.swiper-container-horizontal').should('exist');
323-
cy.get('.swiper-container-vertical').should('not.exist');
322+
cy.get('.swiper-horizontal').should('exist');
323+
cy.get('.swiper-vertical').should('not.exist');
324324
cy.getSlide(2).should(($el) => {
325325
expect($el[0].getBoundingClientRect().x).to.be.greaterThan(100);
326326
});
@@ -333,8 +333,8 @@ context('Core', () => {
333333
cy.initSwiper({
334334
direction: 'vertical',
335335
});
336-
cy.get('.swiper-container-vertical').should('exist');
337-
cy.get('.swiper-container-horizontal').should('not.exist');
336+
cy.get('.swiper-vertical').should('exist');
337+
cy.get('.swiper-horizontal').should('not.exist');
338338
cy.getSlide(2).should(($el) => {
339339
expect($el[0].getBoundingClientRect().y).to.be.greaterThan(100);
340340
});
@@ -408,7 +408,7 @@ context('Core', () => {
408408
it('should not work as createElements false', () => {
409409
cy.window().then((_window) => {
410410
_window.document.body.innerHTML = `
411-
<div class="swiper-container">
411+
<div class="swiper">
412412
<div class="swiper-slide">Slide 1</div>
413413
<div class="swiper-slide">Slide 2</div>
414414
<div class="swiper-slide">Slide 3</div>
@@ -421,7 +421,7 @@ context('Core', () => {
421421
<div class="swiper-slide">Slide 10</div>
422422
</div>
423423
`;
424-
_window.swiperRef = new _window.Swiper('.swiper-container', {
424+
_window.swiperRef = new _window.Swiper('.swiper', {
425425
slidesPerView: 2,
426426
scrollbar: true,
427427
createElements: false,
@@ -440,7 +440,7 @@ context('Core', () => {
440440
it('should not work as createElements false', () => {
441441
cy.window().then((_window) => {
442442
_window.document.body.innerHTML = `
443-
<div class="swiper-container">
443+
<div class="swiper">
444444
<div class="swiper-slide">Slide 1</div>
445445
<div class="swiper-slide">Slide 2</div>
446446
<div class="swiper-slide">Slide 3</div>
@@ -453,7 +453,7 @@ context('Core', () => {
453453
<div class="swiper-slide">Slide 10</div>
454454
</div>
455455
`;
456-
_window.swiperRef = new _window.Swiper('.swiper-container', {
456+
_window.swiperRef = new _window.Swiper('.swiper', {
457457
slidesPerView: 2,
458458
scrollbar: true,
459459
createElements: true,

cypress/support/commands.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Cypress.Commands.add('getSliderWrapper', { prevSubject: 'optional' }, () => {
2424
});
2525

2626
Cypress.Commands.add('getSliderContainer', { prevSubject: 'optional' }, () => {
27-
return cy.get('.swiper-container');
27+
return cy.get('.swiper');
2828
});
2929

3030
Cypress.Commands.add('getSlide', { prevSubject: 'optional' }, (subject, slideIndex) => {
3131
return cy.get(`.swiper-slide:nth-child(${slideIndex + 1})`);
3232
});
3333

3434
Cypress.Commands.add('getSlideContains', { prevSubject: 'optional' }, (subject, content) => {
35-
cy.get('.swiper-container').contains(content);
35+
cy.get('.swiper').contains(content);
3636
});
3737
Cypress.Commands.add('getSlides', { prevSubject: 'optional' }, () => {
3838
return cy.get(`.swiper-slide`);
@@ -48,10 +48,10 @@ Cypress.Commands.add('getPaginationBullet', { prevSubject: 'optional' }, (subjec
4848
Cypress.Commands.add(
4949
'initSwiper',
5050
{ prevSubject: 'optional' },
51-
(subject, config = {}, el = '.swiper-container') => {
51+
(subject, config = {}, el = '.swiper') => {
5252
return cy.window().then((_window) => {
5353
_window.document.body.innerHTML = `
54-
<div class="swiper-container">
54+
<div class="swiper">
5555
<div class="swiper-wrapper">
5656
<div class="swiper-slide">Slide 1</div>
5757
<div class="swiper-slide">Slide 2</div>

cypress/test.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
padding: 0;
3030
}
3131

32-
.swiper-container {
32+
.swiper {
3333
width: 100%;
3434
height: 100%;
3535
}
@@ -58,4 +58,4 @@
5858

5959
<body></body>
6060

61-
</html>
61+
</html>

0 commit comments

Comments
 (0)