| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2015 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. |
| --> |
| |
| <link rel="import" href="/core/test_utils.html"> |
| <link rel="import" href="/core/trace_model/proxy_selectable_item.html"> |
| <link rel="import" href="/core/trace_model/selection_state.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tv.b.unittest.testSuite(function() { |
| var ProxySelectableItem = tv.c.trace_model.ProxySelectableItem; |
| var SelectionState = tv.c.trace_model.SelectionState; |
| |
| test('checkSelectionState_undefinedModelItem', function() { |
| var proxyItem = new ProxySelectableItem(undefined); |
| assert.isFalse(proxyItem.selected); |
| assert.equal(proxyItem.selectionState, SelectionState.NONE); |
| }); |
| |
| test('checkSelectionState_definedModelItem', function() { |
| // Start with a selected model event. |
| var modelItem = {selectionState: SelectionState.SELECTED}; |
| var proxyItem = new ProxySelectableItem(modelItem); |
| assert.isTrue(proxyItem.selected); |
| assert.equal(proxyItem.selectionState, SelectionState.SELECTED); |
| |
| // Change the selection state of the model event to highlighted. |
| modelItem.selectionState = SelectionState.HIGHLIGHTED; |
| assert.isFalse(proxyItem.selected); |
| assert.equal(proxyItem.selectionState, SelectionState.HIGHLIGHTED); |
| }); |
| }); |
| </script> |
| |