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

Add Access Levels to Sharing Permissions #1997

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
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ exports[`VisualEditor VisualEditor component 1`] = `
</button>
</div>
<div
accessLevel={1}
className="mockFileToolbarViewer"
insertableItems="mock-insertable-items"
mode="visual"
Expand Down Expand Up @@ -1177,6 +1178,7 @@ exports[`VisualEditor VisualEditor component changes pages 1`] = `
</button>
</div>
<div
accessLevel={1}
className="mockFileToolbarViewer"
insertableItems="mock-insertable-items"
mode="visual"
Expand Down Expand Up @@ -1820,6 +1822,7 @@ exports[`VisualEditor VisualEditor component changes pages 2`] = `
</button>
</div>
<div
accessLevel={1}
className="mockFileToolbarViewer"
insertableItems="mock-insertable-items"
mode="visual"
Expand Down Expand Up @@ -2509,6 +2512,7 @@ exports[`VisualEditor VisualEditor component with no page 1`] = `
</button>
</div>
<div
accessLevel={1}
className="mockFileToolbarViewer"
insertableItems="mock-insertable-items"
mode="visual"
Expand Down Expand Up @@ -3148,6 +3152,7 @@ exports[`VisualEditor reload disables event listener and calls location.reload 1
</button>
</div>
<div
accessLevel={1}
className="mockFileToolbarViewer"
insertableItems="mock-insertable-items"
mode="visual"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

exports[`File Menu File Menu node 1`] = `
"<div class=\\"visual-editor--drop-down-menu\\"><div class=\\"dropdown is-not-open\\" tabindex=\\"-1\\"><button class=\\"menu-title\\">File</button><div class=\\"menu-items\\"><button>Save Module<span>
CTRL+S</span></button><button>New</button><button>Make a copy...</button><div class=\\"dropdown is-not-open\\" tabindex=\\"-1\\"><button class=\\"menu-title\\">Download</button><div class=\\"menu-items\\"><button>XML Document (.xml)</button><button>JSON Document (.json)</button></div></div><button>Import from file...</button><button>Delete Module...</button><button>Copy LTI Link</button></div></div></div>"
CTRL+S</span></button><button>New</button><button>Make a copy...</button><div class=\\"dropdown is-not-open\\" tabindex=\\"-1\\"><button class=\\"menu-title\\">Download</button><div class=\\"menu-items\\"><button>XML Document (.xml)</button><button>JSON Document (.json)</button></div></div><button>Import from file...</button><button disabled=\\"\\">Delete Module...</button><button>Copy LTI Link</button></div></div></div>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jest.mock('../../../../src/scripts/oboeditor/stores/editor-store', () => ({
import { downloadDocument } from '../../../../src/scripts/common/util/download-document'
jest.mock('../../../../src/scripts/common/util/download-document')

import { FULL, PARTIAL } from 'obojobo-express/server/constants'

const CONTENT_NODE = 'ObojoboDraft.Sections.Content'
const ASSESSMENT_NODE = 'ObojoboDraft.Sections.Assessment'

Expand Down Expand Up @@ -166,7 +168,7 @@ describe('File Menu', () => {
title: 'mockTitle'
}

const component = mount(<FileMenu draftId="mockDraft" model={model} />)
const component = mount(<FileMenu draftId="mockDraft" model={model} accessLevel={FULL} />)

component
.findWhere(n => n.type() === 'button' && n.html().includes('Delete Module...'))
Expand All @@ -175,6 +177,20 @@ describe('File Menu', () => {
expect(ModalUtil.show).toHaveBeenCalled()
})

test('FileMenu does not call Delete if accessLevel is not "Full"', () => {
const model = {
title: 'mockTitle'
}

const component = mount(<FileMenu draftId="mockDraft" model={model} accessLevel={PARTIAL} />)

component
.findWhere(n => n.type() === 'button' && n.html().includes('Delete Module...'))
.simulate('click')

expect(ModalUtil.show).not.toHaveBeenCalled()
})

test('FileMenu calls Copy LTI Link', () => {
const model = {
title: 'mockTitle'
Expand Down
Loading