Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,74 @@ exports[`EditorNav EditorNav component with all list item types 1`] = `
</div>
`;

exports[`EditorNav EditorNav component with start page 1`] = `
<div
className="visual-editor--draft-nav is-locked is-not-open is-enabled"
>
<ul>
<li
className="heading is-not-selected"
>
<span>
label4
</span>
<div
className="visual-editor--more-info "
onKeyDown={[Function]}
>
<button
aria-label="Toggle More Info Box"
className="more-info-button "
onClick={[Function]}
tabIndex={0}
>
<svg
fill="none"
stroke="#000"
viewBox="0 0 214 214"
xmlns="http://www.w3.org/2000/svg"
>
<circle
cx="107"
cy="107"
r="100"
strokeWidth="14"
/>
<circle
cx="57"
cy="107"
fill="#000"
r="7"
strokeWidth="16"
/>
<circle
cx="107"
cy="107"
fill="#000"
r="7"
strokeWidth="16"
/>
<circle
cx="157"
cy="107"
fill="#000"
r="7"
strokeWidth="16"
/>
</svg>
</button>
</div>
</li>
</ul>
<button
className="add-node-button"
onClick={[Function]}
>
+ Add Assessment
</button>
</div>
`;

exports[`EditorNav addAssessment hides the modal and calls EditorUtil 1`] = `undefined`;

exports[`EditorNav addAssessment hides the modal and calls EditorUtil 2`] = `undefined`;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@ exports[`SubMenu SubMenu component adds page 1`] = `
}
],
\\"showMoveButtons\\": true,
\\"isAssessment\\": false
\\"isAssessment\\": false,
\\"navItems\\": [
{
\\"id\\": 5,
\\"type\\": \\"link\\",
\\"label\\": \\"label5\\",
\\"contentType\\": \\"Page\\",
\\"flags\\": {
\\"assessment\\": false
}
}
]
}</div><div class=\\"add-page\\"><button class=\\"add-page-button\\">+ Page</button></div></li>"
`;

Expand Down Expand Up @@ -92,7 +103,17 @@ exports[`SubMenu SubMenu component selected as assessment 1`] = `
}
],
"showMoveButtons": false,
"isAssessment": true
"isAssessment": true,
"navItems": [
{
"id": 6,
"type": "link",
"label": "label6",
"flags": {
"assessment": true
}
}
]
}
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ describe('EditorNav', () => {
test('EditorNav component', () => {
EditorUtil.getOrderedList.mockReturnValueOnce([])
const props = {
navState: {}
navState: {},
model: {
attributes: {
content: {}
}
}
}
const component = renderer.create(<EditorNav {...props} />)
const tree = component.toJSON()
Expand All @@ -49,7 +54,12 @@ describe('EditorNav', () => {
test('EditorNav component adds page', () => {
EditorUtil.getOrderedList.mockReturnValueOnce([])
const props = {
navState: {}
navState: {},
model: {
attributes: {
content: {}
}
}
}
const component = mount(<EditorNav {...props} />)

Expand All @@ -65,7 +75,12 @@ describe('EditorNav', () => {
test('EditorNav component adds assessment', () => {
EditorUtil.getOrderedList.mockReturnValueOnce([])
const props = {
navState: {}
navState: {},
model: {
attributes: {
content: {}
}
}
}
const component = mount(<EditorNav {...props} />)

Expand Down Expand Up @@ -118,6 +133,63 @@ describe('EditorNav', () => {
open: false,
locked: true,
navTargetId: 56 // select this item
},
model: {
attributes: {
content: { start: null },
children: [
{
children: [{ children: [] }, { children: [] }]
},
{
children: []
}
]
}
}
}
const component = renderer.create(<EditorNav {...props} />)
const tree = component.toJSON()
expect(tree).toMatchSnapshot()
})

test('EditorNav component with start page', () => {
EditorUtil.getOrderedList.mockReturnValueOnce([
{
id: 4,
type: 'heading',
label: 'label4',
flags: {}
},
{
id: 56,
type: 'link',
label: 'label5',
contentType: 'Page',
flags: {
assessment: false
}
}
])

const props = {
navState: {
open: false,
locked: true,
navTargetId: 56 // select this item
},
model: {
attributes: {
content: { start: 56 },
children: [
{
children: [{ children: [] }, { children: [] }]
},
{
children: []
}
]
}
}
}
const component = renderer.create(<EditorNav {...props} />)
Expand All @@ -139,7 +211,20 @@ describe('EditorNav', () => {
])
.mockReturnValueOnce([])

const props = { navState: {} }
const props = {
navState: {},
model: {
attributes: {
content: {},
children: [
{},
{
children: [{ children: [{ children: [] }] }, { children: [{ children: [] }] }]
}
]
}
}
}
const component = mount(<EditorNav {...props} />)

component.instance().onNavItemClick({
Expand All @@ -157,7 +242,12 @@ describe('EditorNav', () => {
test('addAssessment hides the modal and calls EditorUtil', () => {
EditorUtil.getOrderedList.mockReturnValue([])
const props = {
navState: {}
navState: {},
model: {
attributes: {
content: {}
}
}
}
const component = mount(<EditorNav {...props} />)

Expand All @@ -177,7 +267,12 @@ describe('EditorNav', () => {
test('addPage hides the modal and calls EditorUtil', () => {
EditorUtil.getOrderedList.mockReturnValue([])
const props = {
navState: {}
navState: {},
model: {
attributes: {
content: {}
}
}
}
const component = mount(<EditorNav {...props} />)

Expand Down

Large diffs are not rendered by default.

Loading