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

Make sure focus related tests don't fail when the test container is hidden #912

Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions addon-test-support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ export function setupTestContainer() {
}

let params = QUnit.urlParams;
let containerVisibility = params.nocontainer ? 'hidden' : 'visible';

if (params.devmode || params.fullscreencontainer) {
testContainer.className = ' full-screen';
testContainer.classList.add('ember-testing-container-full-screen');
}

testContainer.style.visibility = containerVisibility;
if (params.nocontainer) {
testContainer.classList.add('ember-testing-container-hidden');
Copy link
Member Author

@bertdeblock bertdeblock Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First simply used a hidden class, but that is such a commonly used utility class that I switched to using ember-testing-container-hidden to avoid conflicts. I renamed the full-screen class to ember-testing-container-full-screen for the same reason and consistency.

}
}

/**
Expand Down
9 changes: 7 additions & 2 deletions vendor/ember-qunit/test-container-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
transform: translateZ(0);
}

#ember-testing-container.full-screen {
#ember-testing-container.ember-testing-container-full-screen {
width: 100%;
height: 100%;
overflow: auto;
Expand All @@ -39,14 +39,19 @@
right: 0;
}

#ember-testing-container.ember-testing-container-hidden {
opacity: 0;
pointer-events: none;
}

#ember-testing {
width: 200%;
height: 200%;
transform: scale(0.5);
transform-origin: top left;
}

.full-screen #ember-testing {
.ember-testing-container-full-screen #ember-testing {
position: absolute;
width: 100%;
height: 100%;
Expand Down