This repository was archived by the owner on Dec 11, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ const UrlUtil = {
354
354
parsed . hostname = punycode . toASCII ( parsed . hostname )
355
355
return urlFormat ( parsed )
356
356
} catch ( e ) {
357
- return url
357
+ return punycode . toASCII ( url )
358
358
}
359
359
} ,
360
360
Original file line number Diff line number Diff line change @@ -35,6 +35,17 @@ describe('General Panel', function () {
35
35
. waitForInputText ( homepageInput , 'https://www.brave.xn--com-8cd/' )
36
36
} )
37
37
38
+ it ( 'homepage displays punycode without HTTP prefix' , function * ( ) {
39
+ yield this . app . client
40
+ . tabByIndex ( 0 )
41
+ . loadUrl ( prefsUrl )
42
+ . waitForVisible ( homepageInput )
43
+ . click ( homepageInput )
44
+ . keys ( Array . apply ( null , Array ( 50 ) ) . map ( ( ) => Brave . keys . BACKSPACE ) )
45
+ . keys ( 'а' )
46
+ . waitForInputText ( homepageInput , 'xn--80a' )
47
+ } )
48
+
38
49
it ( 'homepage can be backspaced' , function * ( ) {
39
50
yield this . app . client
40
51
. tabByIndex ( 0 )
Original file line number Diff line number Diff line change @@ -280,9 +280,12 @@ describe('urlutil', function () {
280
280
} )
281
281
282
282
describe ( 'getPunycodeUrl' , function ( ) {
283
- it ( 'returns empty string if input is not a URL ' , function ( ) {
283
+ it ( 'returns original string if input is ASCII ' , function ( ) {
284
284
assert . equal ( urlUtil . getPunycodeUrl ( 'invalid-url-goes-here' ) , 'invalid-url-goes-here' )
285
285
} )
286
+ it ( 'returns punycode ASCII string if input is non-ASCII' , function ( ) {
287
+ assert . equal ( urlUtil . getPunycodeUrl ( 'ebаy.com' ) , 'xn--eby-7cd.com' )
288
+ } )
286
289
it ( 'returns the punycode URL when given a valid URL' , function ( ) {
287
290
assert . equal ( urlUtil . getPunycodeUrl ( 'http://brave:brave@ebаy.com:1234/brave#brave' ) , 'http://brave:brave@xn--eby-7cd.com:1234/brave#brave' )
288
291
} )
You can’t perform that action at this time.
0 commit comments