-
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] render attribution with no url as text instead of EuiLink (#31873
- Loading branch information
Showing
3 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...maps/public/components/widget_overlay/attribution_control/__snapshots__/view.test.js.snap
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,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AttributionControl is rendered 1`] = ` | ||
<EuiPanel | ||
className="mapWidgetControl mapAttributionControl" | ||
grow={false} | ||
hasShadow={false} | ||
paddingSize="none" | ||
> | ||
<EuiText | ||
color="subdued" | ||
grow={true} | ||
size="xs" | ||
> | ||
<small> | ||
attribution with no link | ||
, | ||
<EuiLink | ||
color="subdued" | ||
href="https://coolmaps.com" | ||
target="_blank" | ||
type="button" | ||
> | ||
attribution with link | ||
</EuiLink> | ||
</small> | ||
</EuiText> | ||
</EuiPanel> | ||
`; |
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
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/maps/public/components/widget_overlay/attribution_control/view.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,42 @@ | ||
/* | ||
* 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 { AttributionControl } from './view'; | ||
|
||
describe('AttributionControl', () => { | ||
test('is rendered', async () => { | ||
const mockLayer1 = { | ||
getAttributions: async () => { | ||
return [ | ||
{ url: '', label: 'attribution with no link' } | ||
]; | ||
} | ||
}; | ||
const mockLayer2 = { | ||
getAttributions: async () => { | ||
return [ | ||
{ url: 'https://coolmaps.com', label: 'attribution with link' } | ||
]; | ||
} | ||
}; | ||
const component = shallow( | ||
<AttributionControl | ||
layerList={[mockLayer1, mockLayer2]} | ||
/> | ||
); | ||
|
||
// Ensure all promises resolve | ||
await new Promise(resolve => process.nextTick(resolve)); | ||
// Ensure the state changes are reflected | ||
component.update(); | ||
|
||
expect(component) | ||
.toMatchSnapshot(); | ||
}); | ||
}); |