Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix tests failing in IE11 #1570

Merged
merged 6 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/checks/mobile/css-orientation-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ Object.keys(rulesGroupByDocumentFragment).forEach(key => {
return;
}

// check if transform style exists
const transformStyleValue = cssRule.style.transform || false;
// check if transform style exists (don't forget vendor prefixes)
const transformStyleValue =
cssRule.style.transform || cssRule.style.webkitTransform || false;
straker marked this conversation as resolved.
Show resolved Hide resolved
// transformStyleValue -> is the value applied to property
// eg: "rotate(-90deg)"
if (!transformStyleValue) {
Expand Down
51 changes: 23 additions & 28 deletions test/checks/mobile/css-orientation-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ describe('css-orientation-lock tests', function() {
var dynamicDoc = document.implementation.createHTMLDocument(
'Dynamic document for CSS Orientation Lock tests'
);
var isIE11 = axe.testUtils.isIE11;
var isPhantom = window.PHANTOMJS ? true : false;

afterEach(function() {
checks['css-orientation-lock'] = origCheck;
Expand All @@ -23,11 +21,11 @@ describe('css-orientation-lock tests', function() {
MEDIA_STYLE_ORIENTATION_WITHOUT_TRANSFORM:
'@media screen and (min-width: 1px) and (max-width: 2000px) and (orientation: portrait) { #mocha { color: red; } }',
MEDIA_STYLE_ORIENTATION_WITH_TRANSFORM_NOT_ROTATE:
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { #mocha { transform: translateX(10px); } }',
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { #mocha { transform: translateX(10px); -webkit-transform: translateX(10px); } }',
straker marked this conversation as resolved.
Show resolved Hide resolved
MEDIA_STYLE_ORIENTATION_WITH_TRANSFORM_ROTATE_180:
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { body { transform: rotate(180deg); } }',
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { body { transform: rotate(180deg); -webkit-transform: rotate(180deg); } }',
MEDIA_STYLE_ORIENTATION_WITH_TRANSFORM_ROTATE_90:
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { #mocha { transform: rotate(270deg); } }'
'@media screen and (min-width: 1px) and (max-width: 3000px) and (orientation: landscape) { #mocha { transform: rotate(270deg); -webkit-transform: rotate(270deg); } }'
};

function getSheet(data) {
Expand Down Expand Up @@ -221,29 +219,26 @@ describe('css-orientation-lock tests', function() {
});

// This currently breaks in IE11
straker marked this conversation as resolved.
Show resolved Hide resolved
(isIE11 || isPhantom ? it.skip : it)(
'returns false if TRANSFORM style applied is ROTATE, and is divisible by 90 and not divisible by 180',
function() {
var actual = checks['css-orientation-lock'].evaluate.call(
checkContext,
document,
{},
undefined,
{
cssom: [
{
shadowId: undefined,
root: document,
sheet: getSheet(
SHEET_DATA.MEDIA_STYLE_ORIENTATION_WITH_TRANSFORM_ROTATE_90
)
}
]
}
);
assert.isFalse(actual);
}
);
it('returns false if TRANSFORM style applied is ROTATE, and is divisible by 90 and not divisible by 180', function() {
var actual = checks['css-orientation-lock'].evaluate.call(
checkContext,
document,
{},
undefined,
{
cssom: [
{
shadowId: undefined,
root: document,
sheet: getSheet(
SHEET_DATA.MEDIA_STYLE_ORIENTATION_WITH_TRANSFORM_ROTATE_90
)
}
]
}
);
assert.isFalse(actual);
});

// Note:
// external stylesheets is tested in integration tests
Expand Down