blob: a030cab3c9537525c5e49b93f0110b2cac68c441 [file] [log] [blame]
<!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/analysis/size_span.html">
<script>
'use strict';
tv.b.unittest.testSuite(function() {
test('instantiate', function() {
var timeSpan = document.createElement('tv-c-a-size-span');
timeSpan.numBytes = 5 * 1024;
assert.equal(timeSpan.numBytes, 5 * 1024);
this.addHTMLOutput(timeSpan);
});
test('sizeStrings', function() {
var el = document.createElement('tv-c-a-size-span');
el.numBytes = 0;
assert.equal(el.stringContent, '0.0 B');
el.numBytes = 1;
assert.equal(el.stringContent, '1.0 B');
el.numBytes = 1536;
assert.equal(el.stringContent, '1.5 KiB');
el.numBytes = 424.2 * 1024 * 1024;
assert.equal(el.stringContent, '424.2 MiB');
el.numBytes = 5 * 1024 * 1024 * 1024;
assert.equal(el.stringContent, '5.0 GiB');
el.numBytes = 1025 * 1024 * 1024 * 1024 * 1024;
assert.equal(el.stringContent, '1025.0 TiB');
this.addHTMLOutput(el);
});
});
</script>