Closed asapach closed 5 years ago
I'm more in favor to add those style in the new fixture created by QUnit and I don't want to force users to use QUnit css if they doesn't want to
@Johann-S, OK, but that will partially undo #93 - we'll have to move part of the logic from begin()
back into testStart()
. And the remaining logic is kind of unclear:
qunit-fixture
element to the body even if we know that QUnit will wipe it out?customContextFile
-- should we mess with it?// CC @Krinkle
I have no strong opinion specifically on whether to load QUnit's stylesheet in karma-qunit.
However, I would prefer that we not preserve the fixture's DOM reference between tests. QUnit should be allowed to cleanly re-create the fixture for each test.
That leaves us with two options:
Option 1 should work and is quick fix with minimal change.
Option 2 is a slightly bigger change, but I think we should consider it. For a few reasons:
QUnit.version
.@Johann-S wrote: I don't want to force users to use QUnit css if they doesn't want to
I would like to better understand your perspective. It seems both options are mechanisms internal to karma-qunit. In what way does it force or relate to users?
I've created a PR that illustrates what it would look like if we got rid of inline styles: #110
@Krinkle if we enforce the use of QUnit css, showUI
option won't be an option, it will be the default behavior, it looks like a regression or a breaking change
@Johann-S, UI is not enabled until you've added #qunit
element: https://github.com/karma-runner/karma-qunit/blob/a431d3999b5136092a20e4c53babf4865ac78df6/src/adapter.js#L28-L32
So I would not consider this a breaking change.
@Johann-S, do you still have any objections?
good catch @asapach, so LGTM š
Any chance of a new release? This has been fixed in #110
Ping @Johann-S?
I can cut a release on Github but I don't have npm rights š
/CC @dignifiedquire @Krinkle @johnjbarton
done
Looks like my fix for #104 is incomplete. Currently
#qunit-fixture
is being assigned some inline styles: https://github.com/karma-runner/karma-qunit/blob/a431d3999b5136092a20e4c53babf4865ac78df6/src/adapter.js#L47-L55 But since we now setrunner.config.fixture
as an empty string: https://github.com/karma-runner/karma-qunit/blob/a431d3999b5136092a20e4c53babf4865ac78df6/src/adapter.js#L56-L58 QUnit will wipe out those styles, because it creates a new element instead of re-using the existing one: sourceMy initial suggestion was to save the element as
runner.config.fixture = fixture
, which fixes the issue, but as @Krinkle noted, the docs don't mention anything about it being a node.Another potential fix would be to remove the inline styles entirely and rely on the QUnit CSS, which might be more future-proof. This means loading the CSS regardless of the
showUI
flag: https://github.com/karma-runner/karma-qunit/blob/a431d3999b5136092a20e4c53babf4865ac78df6/lib/index.js#L15-L17What do you guys think?
Here's a repro: https://github.com/asapach/karma-qunit-fixture