Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Feature: Add env.isEdge property. #248

Merged
merged 4 commits into from
Jul 6, 2018
Merged

Feature: Add env.isEdge property. #248

merged 4 commits into from
Jul 6, 2018

Conversation

jodator
Copy link
Contributor

@jodator jodator commented Jul 5, 2018

Suggested merge commit message (convention)

Feature: Introduce env.isEdge property.


Additional information

@coveralls
Copy link

coveralls commented Jul 5, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 337a624 on t/ckeditor5/1079 into d561151 on master.

src/env.js Outdated
* @returns {Boolean} Whether User Agent is Edge or not.
*/
export function isEdge( userAgent ) {
return userAgent.indexOf( 'edge' ) > -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's unsafe. There are many words with "edge" in them. Something more precise would be better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Reinmar I'm not 100% sure but it looks like [ /] in that regex could be restricted to:

/edge\/(\d+.?\d*)/

I couldn't find why there is space allowed...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ps.: https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh869301(v=vs.85)

Describes only Edge/<EdgeHTML Rev>.<Windows Build> as possible value so I've set the regex accordingly to this.

@@ -31,4 +37,19 @@ describe( 'Env', () => {
expect( isMac( 'foo' ) ).to.be.false;
} );
} );

describe( 'isEdge()', () => {
it( 'returns true for Edge UA strings', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a single real UA string ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - I've copied from other test. I'm adding some real ones right now ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK... I was too slow 😞

@Reinmar Reinmar merged commit 13d4af4 into master Jul 6, 2018
@Reinmar Reinmar deleted the t/ckeditor5/1079 branch July 6, 2018 09:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants