-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2039 from brave/ca-3805-62
[0.62.x] block default chrome url in topsites list
- Loading branch information
Showing
3 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
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
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,52 @@ | ||
/* global describe, it */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import { getGridSites } from '../../brave_new_tab_ui/api' | ||
|
||
describe('new tab api tests', () => { | ||
const defaultState = { | ||
topSites: [], | ||
ignoredTopSites: [], | ||
pinnedTopSites: [], | ||
bookmarks: {} | ||
} | ||
describe('getGridSites', () => { | ||
it('allows http sites', () => { | ||
const url = 'http://cezaraugusto.net' | ||
const newState = { | ||
...defaultState, | ||
topSites: [ | ||
{ url } | ||
] | ||
} | ||
const assertion = getGridSites(newState, true) | ||
expect(assertion[0]).toBe(newState.topSites[0]) | ||
expect(assertion[0].url).toBe(url) | ||
}) | ||
it('allows https sites', () => { | ||
const url = 'https://cezaraugusto.net' | ||
const newState = { | ||
...defaultState, | ||
topSites: [ | ||
{ url } | ||
] | ||
} | ||
const assertion = getGridSites(newState, true) | ||
expect(assertion[0]).toBe(newState.topSites[0]) | ||
expect(assertion[0].url).toBe(url) | ||
}) | ||
it('do not allow the default chrome topSites url', () => { | ||
const url = 'https://chrome.google.com/webstore?hl=en' | ||
const newState = { | ||
...defaultState, | ||
topSites: [ | ||
{ url } | ||
] | ||
} | ||
const assertion = getGridSites(newState, true) | ||
expect(assertion[0]).toBe(undefined) | ||
}) | ||
}) | ||
}) |
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