mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-23 12:12:50 +00:00
f5de8ee108
* eslint-config-wikimedia: 0.27.0 → 0.28.0 The following rules are failing and were disabled: * modules: * no-mixed-spaces-and-tabs * no-jquery/no-extend * implicit-arrow-linebreak * tests/qunit: * no-jquery/no-extend * grunt-stylelint: 0.19.0 → 0.20.0 * stylelint-config-wikimedia: 0.16.1 → 0.17.1 Change-Id: I3fd3c4a2cbb03d3aa4c8efb658e33d14d24cd518
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require( 'assert' ),
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
describe( 'RevisionSlider expand', () => {
|
|
|
|
before( async () => {
|
|
await DiffPage.prepareSimpleTests( 2 );
|
|
} );
|
|
|
|
beforeEach( async () => {
|
|
DiffPage.ready();
|
|
} );
|
|
|
|
afterEach( async () => {
|
|
await DiffPage.resetAutoExpand();
|
|
await browser.refresh();
|
|
} );
|
|
|
|
it( ' does not automatically expand by default', async () => {
|
|
assert(
|
|
await DiffPage.rsToggleButton.isDisplayed(),
|
|
'there should be a RevisionSlider expand button'
|
|
);
|
|
assert(
|
|
!await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
|
|
it( ' expands automatically when auto expand is on', async () => {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
|
|
await browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
await DiffPage.rsMain.waitForDisplayed( { timeout: 10000 } );
|
|
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
|
assert(
|
|
classAttr.includes( 'oo-ui-toggleWidget-on' ),
|
|
'the auto expand button should be on'
|
|
);
|
|
assert(
|
|
await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
} );
|
|
|
|
it( ' does not expand automatically when auto expand is off', async () => {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
await DiffPage.rsAutoExpandButton.click();
|
|
|
|
await browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
// this includes clicking the toggle button
|
|
// an auto-expanded slider would be closed then
|
|
await DiffPage.openSlider();
|
|
const classAttr = await DiffPage.rsAutoExpandButton.getAttribute( 'class' );
|
|
assert(
|
|
await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
assert(
|
|
!( await classAttr.includes( 'oo-ui-toggleWidget-on' ) ),
|
|
'the auto expand button should be off'
|
|
);
|
|
} );
|
|
|
|
it( ' hides when collapsed manually', async () => {
|
|
await DiffPage.openSlider();
|
|
await DiffPage.rsToggleButton.click();
|
|
|
|
assert(
|
|
!await DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
} );
|