Skip to content

Commit

Permalink
fix whitespace difference
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik-Petrik committed Jun 5, 2024
1 parent ef56ada commit 67da79e
Showing 1 changed file with 56 additions and 45 deletions.
101 changes: 56 additions & 45 deletions packages/react-integration/cypress/integration/slider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ describe('Slider Demo Test', () => {

it('renders the discrete slider', () => {
cy.get('#discrete-slider').should('exist');
cy.get('#discrete-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 62.5%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);
cy.get('#discrete-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 62.5%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:62.5%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
});

it('changes discrete slider value when dragged', () => {
cy.get('#discrete-slider > .pf-v5-c-slider__main > .pf-v5-c-slider__thumb')
.trigger('mousedown', { which: 1 })
.trigger('mousemove', 150, 10, { force: true })
.trigger('mouseup', { force: true });
cy.get('#discrete-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 75%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);
cy.get('#discrete-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 75%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:75%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
});

it('renders the slider with input', () => {
Expand All @@ -32,41 +34,46 @@ describe('Slider Demo Test', () => {
cy.get(
'#discrete-slider-input-label > .pf-v5-c-slider__value > .pf-v5-c-input-group > .pf-v5-c-input-group__item > .pf-v5-c-input-group__text'
).should('exist');
cy.get('#discrete-slider-input-label').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 50%; --pf-v5-c-slider__value--c-form-control--width-chars: 2;'
);
cy.get('#discrete-slider-input-label')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 50%; --pf-v5-c-slider__value--c-form-control--width-chars: 2;',
'--pf-v5-c-slider--value:50%; --pf-v5-c-slider__value--c-form-control--width-chars:2;'
]);
});

it('renders the continuous slider', () => {
cy.get('#continuous-slider').should('exist');
cy.get('#continuous-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 50%; --pf-v5-c-slider__value--c-form-control--width-chars: 2;'
);
cy.get('#continuous-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 50%; --pf-v5-c-slider__value--c-form-control--width-chars: 2;',
'--pf-v5-c-slider--value:50%; --pf-v5-c-slider__value--c-form-control--width-chars:2;'
]);
});

it('changes continuous slider value when dragged', () => {
cy.get('#continuous-slider > .pf-v5-c-slider__main > .pf-v5-c-slider__thumb')
.trigger('mousedown', { which: 1 })
.trigger('mousemove', 430, 10, { force: true })
.trigger('mouseup', { force: true });
cy.get('#continuous-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 100%; --pf-v5-c-slider__value--c-form-control--width-chars: 3;'
);

cy.get('#continuous-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 100%; --pf-v5-c-slider__value--c-form-control--width-chars: 3;',
'--pf-v5-c-slider--value:100%; --pf-v5-c-slider__value--c-form-control--width-chars:3;'
]);
});

it('renders the disabled slider', () => {
cy.get('#disabled-slider').should('exist');
cy.get('#disabled-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);
cy.get('#disabled-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:20%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
cy.get('#disabled-slider').should('have.class', 'pf-m-disabled');
});

Expand All @@ -75,31 +82,35 @@ describe('Slider Demo Test', () => {
.trigger('mousedown', { which: 1 })
.trigger('mousemove', 430, 10, { force: true })
.trigger('mouseup', { force: true });
cy.get('#disabled-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);
cy.get('#disabled-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:20%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
});

it('renders slider with custom steps', () => {
cy.get('#custom-steps-slider').should('exist');
cy.get('#custom-steps-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);

cy.get('#custom-steps-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 20%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:20%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
});

it('changes custom steps slider value when dragged', () => {
cy.get('#custom-steps-slider > .pf-v5-c-slider__main > .pf-v5-c-slider__thumb')
.trigger('mousedown', { which: 1 })
.trigger('mousemove', -200, 10, { force: true })
.trigger('mouseup', { force: true });
cy.get('#custom-steps-slider').should(
'have.attr',
'style',
'--pf-v5-c-slider--value: 0%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;'
);
cy.get('#custom-steps-slider')
.invoke('attr', 'style')
.should('be.oneOf', [
'--pf-v5-c-slider--value: 0%; --pf-v5-c-slider__value--c-form-control--width-chars: 1;',
'--pf-v5-c-slider--value:0%; --pf-v5-c-slider__value--c-form-control--width-chars:1;'
]);
});
});

0 comments on commit 67da79e

Please sign in to comment.