-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] fix tile layer attibution text and attribution link validation…
… errors (#73160) (#73173) * [Maps] fix tile layer attibution text and attribution link validation errors * clean up jest test * tslint * one more tslint
- Loading branch information
Showing
4 changed files
with
318 additions
and
59 deletions.
There are no files selected for viewing
237 changes: 237 additions & 0 deletions
237
...ins/maps/public/classes/sources/xyz_tms_source/__snapshots__/xyz_tms_editor.test.tsx.snap
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
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/maps/public/classes/sources/xyz_tms_source/xyz_tms_editor.test.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,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { XYZTMSEditor } from './xyz_tms_editor'; | ||
|
||
const onSourceConfigChange = () => {}; | ||
|
||
test('should render', () => { | ||
const component = shallow(<XYZTMSEditor onSourceConfigChange={onSourceConfigChange} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
describe('attribution validation', () => { | ||
test('should provide validation error when attribution text is provided without attribution url', () => { | ||
const component = shallow(<XYZTMSEditor onSourceConfigChange={onSourceConfigChange} />); | ||
component.setState({ attributionText: 'myAttribtionLabel' }); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should provide validation error when attribution url is provided without attribution text', () => { | ||
const component = shallow(<XYZTMSEditor onSourceConfigChange={onSourceConfigChange} />); | ||
component.setState({ attributionUrl: 'http://mySource' }); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
test('should provide no validation errors when attribution text and attribution url are provided', () => { | ||
const component = shallow(<XYZTMSEditor onSourceConfigChange={onSourceConfigChange} />); | ||
component.setState({ attributionText: 'myAttribtionLabel' }); | ||
component.setState({ attributionUrl: 'http://mySource' }); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.