Skip to content

Commit

Permalink
convert functioniterates tests to vitest
Browse files Browse the repository at this point in the history
add text state variable to li component
  • Loading branch information
dqnykamp committed Oct 22, 2024
1 parent fc0fa27 commit 2245af6
Show file tree
Hide file tree
Showing 3 changed files with 503 additions and 1,245 deletions.
21 changes: 21 additions & 0 deletions packages/doenetml-worker/src/components/Lists.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BlockComponent from "./abstract/BlockComponent";
import BaseComponent from "./abstract/BaseComponent";
import { textFromChildren } from "../utils/text";

export class Ol extends BlockComponent {
constructor(args) {
Expand Down Expand Up @@ -172,6 +173,26 @@ export class Li extends BaseComponent {
definition: () => ({ setValue: { item: true } }),
};

stateVariableDefinitions.text = {
public: true,
shadowingInstructions: {
createComponentOfType: "text",
},
returnDependencies: () => ({
children: {
dependencyType: "child",
childGroups: ["anything"],
variableNames: ["text", "hidden"],
variablesOptional: true,
},
}),
definition: function ({ dependencyValues }) {
let text = textFromChildren(dependencyValues.children);

return { setValue: { text } };
},
};

return stateVariableDefinitions;
}

Expand Down
Loading

0 comments on commit 2245af6

Please sign in to comment.