From d7e1fe09fc7512d1866a49ca72a28882b376888b Mon Sep 17 00:00:00 2001 From: Benedict Aas Date: Fri, 16 Dec 2016 14:41:04 +0000 Subject: [PATCH] feat(gui): label system drives in drive-list widget (#978) System drives in the drive-list widget now have a red warning label beneath. Also new is the `isSystemDrive()` method under `SelectionStateModel` and its unit-tests. See: https://github.com/resin-io/etcher/issues/888 Changelog-Entry: Label system drives in the drive-list widget --- .../templates/drive-selector-modal.tpl.html | 5 ++++ lib/gui/models/selection-state.js | 22 +++++++++++++++ tests/gui/models/selection-state.spec.js | 27 +++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html index 95c3aa03..33671fb5 100644 --- a/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html +++ b/lib/gui/components/drive-selector/templates/drive-selector-modal.tpl.html @@ -35,6 +35,11 @@ LOCKED + + + SYSTEM DRIVE + { + return Boolean(drive.system); + }; + /** * @summary Toggle set drive * @function diff --git a/tests/gui/models/selection-state.spec.js b/tests/gui/models/selection-state.spec.js index 8fe3810c..f96e42db 100644 --- a/tests/gui/models/selection-state.spec.js +++ b/tests/gui/models/selection-state.spec.js @@ -137,6 +137,33 @@ describe('Browser: SelectionState', function() { }); + describe('.isSystemDrive()', function() { + + it('should return true if the drive is a system drive', function() { + const result = SelectionStateModel.isSystemDrive({ + device: '/dev/disk2', + name: 'USB Drive', + size: 999999999, + protected: true, + system: true + }); + + m.chai.expect(result).to.be.true; + }); + + it('should return false if the drive is a removable drive', function() { + const result = SelectionStateModel.isSystemDrive({ + device: '/dev/disk2', + name: 'USB Drive', + size: 999999999, + protected: true, + system: false + }); + + m.chai.expect(result).to.be.false; + }); + }); + describe('given a drive', function() { beforeEach(function() {