-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from creative-commoners/pulls/4/remove-menu
ENH Remove LinkFieldController from cms menu
- Loading branch information
1 parent
c171ae8
commit 163c11c
Showing
31 changed files
with
563 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
<?php | ||
|
||
use SilverStripe\Core\Manifest\ModuleLoader; | ||
use SilverStripe\Forms\HTMLEditor\TinyMCEConfig; | ||
use SilverStripe\Admin\CMSMenu; | ||
use SilverStripe\LinkField\Controllers\LinkFieldController; | ||
|
||
// Avoid creating global variables | ||
call_user_func(function () { | ||
}); | ||
CMSMenu::remove_menu_class(LinkFieldController::class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* global jest, test */ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import LinkPicker from '../LinkPicker'; | ||
|
||
function makeProps(obj = {}) { | ||
return { | ||
types: [{ key: 'phone', title: 'Phone' }], | ||
onModalSuccess: () => {}, | ||
onModalClosed: () => {}, | ||
...obj | ||
}; | ||
} | ||
|
||
test('LinkPickerMenu render() should display toggle if can create', () => { | ||
const { container } = render(<LinkPicker {...makeProps({ | ||
canCreate: true | ||
})} | ||
/>); | ||
expect(container.querySelectorAll('.link-picker__menu-toggle')).toHaveLength(1); | ||
expect(container.querySelectorAll('.link-picker__cannot-create')).toHaveLength(0); | ||
}); | ||
|
||
test('LinkPickerMenu render() should display cannot create message if cannot create', () => { | ||
const { container } = render(<LinkPicker {...makeProps({ | ||
canCreate: false | ||
})} | ||
/>); | ||
expect(container.querySelectorAll('.link-picker__menu-toggle')).toHaveLength(0); | ||
expect(container.querySelectorAll('.link-picker__cannot-create')).toHaveLength(1); | ||
}); |
34 changes: 34 additions & 0 deletions
34
client/src/components/LinkPicker/tests/LinkPickerTitle-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* global jest, test */ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import LinkPickerTitle from '../LinkPickerTitle'; | ||
|
||
function makeProps(obj = {}) { | ||
return { | ||
id: 1, | ||
title: 'My title', | ||
description: 'My description', | ||
versionState: 'draft', | ||
typeTitle: 'Phone', | ||
onClear: () => {}, | ||
onClick: () => {}, | ||
...obj | ||
}; | ||
} | ||
|
||
test('LinkPickerTitle render() should display clear button if can delete', () => { | ||
const { container } = render(<LinkPickerTitle {...makeProps({ | ||
canDelete: true | ||
})} | ||
/>); | ||
expect(container.querySelectorAll('.link-picker__clear')).toHaveLength(1); | ||
}); | ||
|
||
test('LinkPickerTitle render() should not display clear button if cannot delete', () => { | ||
const { container } = render(<LinkPickerTitle {...makeProps({ | ||
canDelete: false | ||
})} | ||
/>); | ||
expect(container.querySelectorAll('.link-picker__clear')).toHaveLength(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.