mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Add missing css_classes
unit test
This commit is contained in:
parent
46a3b65cb6
commit
b6e096a1cc
@ -144,6 +144,24 @@ describe("Trial", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("respects the `css_classes` trial parameter", async () => {
|
||||
const displayElement = dependencies.getDisplayElement();
|
||||
|
||||
let trial = createTrial({ type: TestPlugin, css_classes: "class1" });
|
||||
expect(displayElement.classList.value).toEqual("");
|
||||
trial.run();
|
||||
expect(displayElement.classList.value).toEqual("class1");
|
||||
await TestPlugin.finishTrial();
|
||||
expect(displayElement.classList.value).toEqual("");
|
||||
|
||||
trial = createTrial({ type: TestPlugin, css_classes: ["class1", "class2"] });
|
||||
expect(displayElement.classList.value).toEqual("");
|
||||
trial.run();
|
||||
expect(displayElement.classList.value).toEqual("class1 class2");
|
||||
await TestPlugin.finishTrial();
|
||||
expect(displayElement.classList.value).toEqual("");
|
||||
});
|
||||
|
||||
it("invokes the local `on_finish` callback with the result data", async () => {
|
||||
const onFinishCallback = jest.fn();
|
||||
const trial = createTrial({ type: TestPlugin, on_finish: onFinishCallback });
|
||||
|
@ -115,8 +115,6 @@ export class Trial extends TimelineNode {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO there were `Trial` unit tests for css classes once => restore them!
|
||||
|
||||
/**
|
||||
* Add the CSS classes from the `css_classes` parameter to the display element
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user