mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-20 10:50:40 +00:00
1fa153aeab
The new mw eslint config comes with node 12 and the change will be quite big due to the lock file. I wanted to keep the diff of actual code changes seperate. - Applied all code style recommendations - Removed one test that's not giving any value - Changed regex .match to .test for performance and convinience Change-Id: I578be8c6460c7a4d1220354c028a9bfd9bb86d13
84 lines
1.9 KiB
JavaScript
84 lines
1.9 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require( 'assert' ),
|
|
DiffPage = require( '../pageobjects/diff.page' );
|
|
|
|
describe( 'RevisionSlider expand', function () {
|
|
|
|
before( function () {
|
|
DiffPage.prepareSimpleTests( 2 );
|
|
} );
|
|
|
|
beforeEach( function () {
|
|
DiffPage.ready();
|
|
} );
|
|
|
|
afterEach( function () {
|
|
DiffPage.resetAutoExpand();
|
|
browser.refresh();
|
|
} );
|
|
|
|
it( ' does not automatically expand by default', function () {
|
|
assert(
|
|
DiffPage.rsToggleButton.isDisplayed(),
|
|
'there should be a RevisionSlider expand button'
|
|
);
|
|
assert(
|
|
!DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
|
|
it( ' expands automatically when auto expand is on', function () {
|
|
DiffPage.openSlider();
|
|
DiffPage.rsAutoExpandButton.click();
|
|
|
|
browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
DiffPage.rsMain.waitForDisplayed( { timeout: 10000 } );
|
|
|
|
assert(
|
|
DiffPage.rsAutoExpandButton.getAttribute( 'class' )
|
|
.includes( 'oo-ui-toggleWidget-on' ),
|
|
'the auto expand button should be on'
|
|
);
|
|
assert(
|
|
DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
} );
|
|
|
|
it( ' does not expand automatically when auto expand is off', function () {
|
|
DiffPage.openSlider();
|
|
DiffPage.rsAutoExpandButton.click();
|
|
DiffPage.rsAutoExpandButton.click();
|
|
|
|
browser.refresh();
|
|
DiffPage.ready();
|
|
|
|
// this includes clicking the toggle button
|
|
// an auto-expanded slider would be closed then
|
|
DiffPage.openSlider();
|
|
assert(
|
|
DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be visible'
|
|
);
|
|
assert(
|
|
!DiffPage.rsAutoExpandButton.getAttribute( 'class' )
|
|
.includes( 'oo-ui-toggleWidget-on' ),
|
|
'the auto expand button should be off'
|
|
);
|
|
} );
|
|
|
|
it( ' hides when collapsed manually', function () {
|
|
DiffPage.openSlider();
|
|
DiffPage.rsToggleButton.click();
|
|
|
|
assert(
|
|
!DiffPage.rsMain.isDisplayed(),
|
|
'the RevisionSlider wrapper should be hidden'
|
|
);
|
|
} );
|
|
} );
|