1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Fix the rendering of certain domain names in connected-sites list (#16074)

* Fix rendering origins in connected-sites list
This commit is contained in:
Nicholas Ellul 2022-11-04 09:26:51 -04:00 committed by GitHub
parent 121b6809f8
commit 300919cfcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 5 deletions

View File

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix issue where domain names were not always beign rendered correctly in the connected sites list ([#16074](https://github.com/MetaMask/metamask-extension/pull/16074))
## [10.21.1]
### Changed

View File

@ -112,11 +112,11 @@ describe('Dapp interactions', function () {
await driver.clickElement({ text: 'Connected sites', tag: 'span' });
const connectedDapp1 = await driver.isElementPresent({
text: 'http://127.0.0.1:8080',
tag: 'span',
tag: 'bdi',
});
const connectedDapp2 = await driver.isElementPresent({
text: 'http://127.0.0.1:8081',
tag: 'span',
tag: 'bdi',
});
assert.ok(connectedDapp1, 'Account not connected to Dapp1');

View File

@ -135,9 +135,11 @@ exports[`SignatureRequestOriginal should match snapshot 1`] = `
<div
class="site-origin request-signature__origin"
>
<span>
<bdi
dir="ltr"
>
https://happydapp.website/governance?futarchy=true
</span>
</bdi>
</div>
</div>
<div

View File

@ -30,7 +30,7 @@ export default function SiteOrigin({
rightIcon={rightIcon}
/>
) : (
<span>{siteOrigin}</span>
<bdi dir="ltr">{siteOrigin}</bdi>
)}
</div>
);

View File

@ -0,0 +1,24 @@
import React from 'react';
import { shallow } from 'enzyme';
import SiteOrigin from './site-origin';
describe('SiteOrigin', () => {
const defaultProps = {
siteOrigin: 'https://example.com',
iconSrc: 'https://example.com/icon.png',
iconName: 'icon',
chip: false,
className: '',
rightIcon: false,
};
it('renders number and hyphen prefixed domains correctly', () => {
const numberHyphenPrefixOrigin = '0-example.com';
const wrapper = shallow(
<SiteOrigin {...defaultProps} siteOrigin={numberHyphenPrefixOrigin} />,
);
const bdiElement = wrapper.find('bdi');
expect(bdiElement.text()).toBe('0-example.com');
});
});