-
Notifications
You must be signed in to change notification settings - Fork 14
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 #60 from rolandschuetz/BUGFIX/node-with-hash-handling
BUGFIX: Prevent the node editor from breaking for nodes with hashes
- Loading branch information
Showing
8 changed files
with
132 additions
and
6 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 |
---|---|---|
|
@@ -46,6 +46,15 @@ describe('LinkType: Asset', () => { | |
.toBe(true); | ||
}); | ||
|
||
it('is not satisfied by asset:// links with a hash', () => { | ||
const link = { | ||
href: 'asset://97c9a6e3-4b50-4559-9f60-b5ad68f25758#section' | ||
}; | ||
|
||
expect(Asset.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is not satisfied by mailto: links', () => { | ||
const link = { | ||
href: 'mailto:[email protected]' | ||
|
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
95 changes: 95 additions & 0 deletions
95
Neos.Ui/core/src/application/LinkTypes/CustomLink/CustomLink.spec.tsx
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,95 @@ | ||
jest.mock('@neos-project/neos-ui-backend-connector', () => ({}), { virtual: true }); | ||
jest.mock('@neos-project/react-ui-components', () => ({})); | ||
jest.mock('@sitegeist/archaeopteryx-custom-node-tree', () => ({})); | ||
jest.mock('@neos-project/neos-ui-redux-store', () => ({}), { virtual: true }); | ||
jest.mock('@neos-project/neos-ui-editors', () => ({}), { virtual: true }); | ||
|
||
jest.mock('../../../presentation', () => ({})); | ||
|
||
import '@testing-library/jest-dom/extend-expect'; | ||
|
||
import {CustomLink} from './CustomLink'; | ||
|
||
|
||
describe('LinkType: Node', () => { | ||
it('is not satisfied by http:// links', () => { | ||
const link = { | ||
href: 'http://www.example.com' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is not satisfied by https:// links', () => { | ||
const link = { | ||
href: 'https://www.example.com' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is not satisfied by node:// links', () => { | ||
const link = { | ||
href: 'node://97c9a6e3-4b50-4559-9f60-b5ad68f25758' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is satisfied by node:// links with a hash', () => { | ||
const link = { | ||
href: 'node://97c9a6e3-4b50-4559-9f60-b5ad68f25758#section' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(true); | ||
}); | ||
|
||
it('is not satisfied by asset:// links', () => { | ||
const link = { | ||
href: 'asset://97c9a6e3-4b50-4559-9f60-b5ad68f25758' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is satisfied by asset:// links with a hash', () => { | ||
const link = { | ||
href: 'asset://97c9a6e3-4b50-4559-9f60-b5ad68f25758#section' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(true); | ||
}); | ||
|
||
it('is not satisfied by mailto: links', () => { | ||
const link = { | ||
href: 'mailto:[email protected]' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
|
||
it('is satisfied by invalid links', () => { | ||
const link = { | ||
href: 'Think of Beethoven\'s 5th: foo foo foo bar' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(true); | ||
}); | ||
|
||
it('is not satisfied by tel: links', () => { | ||
const link = { | ||
href: 'tel:+491258795857' | ||
}; | ||
|
||
expect(CustomLink.isSuitableFor(link)) | ||
.toBe(false); | ||
}); | ||
}); |
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
Large diffs are not rendered by default.
Oops, something went wrong.