-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Nearby] Add scrollable list of discovered devices.
This is the bare bones version without icons or selected state. Screenshot: https://screenshot.googleplex.com/Fxqbguwth60.png Bug: 1103190 Change-Id: I394b281e1bbf59a9c0bc67b2715f480dc0a9229e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300110 Commit-Queue: Michael van Ouwerkerk <mvanouwerkerk@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Reviewed-by: Richard Knoll <knollr@chromium.org> Cr-Commit-Position: refs/heads/master@{#788964}
- Loading branch information
Showing
9 changed files
with
127 additions
and
0 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,25 @@ | ||
<style> | ||
:host { | ||
align-items: center; | ||
border: 1px solid rgba(216, 216, 216, 0.76); | ||
border-radius: 8px; | ||
box-sizing: border-box; | ||
display: flex; | ||
height: 40px; | ||
margin-top: 6px; | ||
} | ||
|
||
#name { | ||
color: rgb(95, 99, 104); | ||
flex-grow: 1; | ||
font-size: 11px; | ||
font-weight: 500; | ||
letter-spacing: 0.3px; | ||
overflow: hidden; | ||
text-align: center; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
</style> | ||
|
||
<div id="name">[[name]]</div> |
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,23 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/** | ||
* @fileoverview The 'nearby-device' component shows details of a remote device. | ||
*/ | ||
|
||
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; | ||
|
||
Polymer({ | ||
is: 'nearby-device', | ||
|
||
_template: html`{__html_template__}`, | ||
|
||
properties: { | ||
/** The device name to show. */ | ||
name: { | ||
type: String, | ||
value: '', | ||
}, | ||
}, | ||
}); |
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
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
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,37 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// So that mojo is defined. | ||
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; | ||
|
||
import 'chrome://nearby/nearby_device.js'; | ||
|
||
import {assertEquals} from '../chai_assert.js'; | ||
|
||
suite('DeviceTest', function() { | ||
/** @type {!NearbyDeviceElement} */ | ||
let deviceElement; | ||
|
||
setup(function() { | ||
deviceElement = /** @type {!NearbyDeviceElement} */ ( | ||
document.createElement('nearby-device')); | ||
document.body.appendChild(deviceElement); | ||
}); | ||
|
||
teardown(function() { | ||
deviceElement.remove(); | ||
}); | ||
|
||
test('renders component', function() { | ||
assertEquals('NEARBY-DEVICE', deviceElement.tagName); | ||
}); | ||
|
||
test('renders name', function() { | ||
const name = 'Name'; | ||
deviceElement.setAttribute('name', name); | ||
|
||
const renderedName = deviceElement.$$('#name').textContent; | ||
assertEquals(name, renderedName); | ||
}); | ||
}); |