mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #32244 from overleaf/ab-labs-in-feature-flags
[web] Merge Labs programme into the Feature flags system GitOrigin-RevId: db75e07bf3272becc11ef1eeda3850098b3daa9d
This commit is contained in:
committed by
Copybot
parent
6f3e0963b8
commit
671df33da3
@@ -0,0 +1,30 @@
|
||||
import { expect } from 'chai'
|
||||
import { render } from '@testing-library/react'
|
||||
|
||||
import { LabsDescription } from '@/shared/components/labs/labs-description'
|
||||
|
||||
describe('<LabsDescription />', function () {
|
||||
it('adds rel and target attributes to rendered links', function () {
|
||||
const { container } = render(
|
||||
<LabsDescription description="A [link](https://example.com)." />
|
||||
)
|
||||
|
||||
const link = container.querySelector('a')
|
||||
expect(link).to.not.equal(null)
|
||||
expect(link?.getAttribute('href')).to.equal('https://example.com')
|
||||
expect(link?.getAttribute('rel')).to.equal('noreferrer noopener')
|
||||
expect(link?.getAttribute('target')).to.equal('_BLANK')
|
||||
})
|
||||
|
||||
it('preserves href sanitization for unsafe links', function () {
|
||||
const { container } = render(
|
||||
<LabsDescription description="A [link](javascript:alert(1))." />
|
||||
)
|
||||
|
||||
const link = container.querySelector('a')
|
||||
expect(link).to.not.equal(null)
|
||||
expect(link?.getAttribute('href')).to.equal('')
|
||||
expect(link?.getAttribute('rel')).to.equal('noreferrer noopener')
|
||||
expect(link?.getAttribute('target')).to.equal('_BLANK')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user