This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with lost tabs ordering on relaunch
siteProps function returns an object without order field, but this field needs to apply correct custom sorting for tabs. Fix #8543
- Loading branch information
1 parent
14cc060
commit 31e8cdd
Showing
3 changed files
with
55 additions
and
8 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,13 @@ | ||
/* 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/. */ | ||
|
||
const Immutable = require('immutable') | ||
|
||
module.exports.getSiteProps = site => { | ||
return Immutable.fromJS({ | ||
location: site.get('location'), | ||
order: site.get('order'), | ||
partitionNumber: site.get('partitionNumber') || 0 | ||
}) | ||
} |
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,40 @@ | ||
/* global describe, beforeEach, it */ | ||
const windowsUtil = require('../../../../../app/common/lib/windowsUtil') | ||
const assert = require('assert') | ||
const Immutable = require('immutable') | ||
|
||
require('../../../braveUnit') | ||
|
||
describe('windowsUtil', () => { | ||
const location = 'https://css-tricks.com/' | ||
const order = 9 | ||
const partitionNumber = 5 | ||
const expectedSiteProps = Immutable.fromJS({ | ||
location, | ||
order, | ||
partitionNumber | ||
}) | ||
let site | ||
|
||
describe('getSiteProps', () => { | ||
beforeEach(() => { | ||
site = Immutable.fromJS({ | ||
favicon: 'https://css-tricks.com/favicon.ico', | ||
lastAccessedTime: 1493560182224, | ||
location: location, | ||
order: order, | ||
partitionNumber: partitionNumber, | ||
title: 'CSS-Tricks' | ||
}) | ||
}) | ||
it('returns object with necessary fields', () => { | ||
const result = windowsUtil.getSiteProps(site) | ||
assert.deepEqual(expectedSiteProps, result) | ||
}) | ||
it('set partitionNumber field to 0 in case of missing this field', () => { | ||
site = site.delete('partitionNumber') | ||
const result = windowsUtil.getSiteProps(site) | ||
assert.equal(0, result.get('partitionNumber')) | ||
}) | ||
}) | ||
}) |