blob: c051768e2f76094eb1a9815a40d4300084fed272 [file] [log] [blame]
Jamie Gennis2da489c2012-09-19 18:06:29 -07001<!DOCTYPE HTML>
2<html>
3<!--
4Copyright (c) 2012 The Chromium Authors. All rights reserved.
5Use of this source code is governed by a BSD-style license that can be
6found in the LICENSE file.
7-->
8<head>
9<title>UI tests</title>
10<script src="base.js"></script>
11<script>
12 base.require('unittest');
13 base.require('ui');
14</script>
15</head>
16<body>
17<script>
18 'use strict';
19
Jeff Brown88448d92013-03-27 17:00:08 -070020 var TestElement = tracing.ui.define('div');
Jamie Gennis2da489c2012-09-19 18:06:29 -070021 TestElement.prototype = {
22 __proto__: HTMLDivElement.prototype,
23
24 decorate: function() {
25 if (!this.decorateCallCount)
26 this.decorateCallCount = 0;
27 this.decorateCallCount++;
28 }
29 };
30
31 function testDecorateOnceViaNew() {
32 var testElement = new TestElement();
33 assertEquals(1, testElement.decorateCallCount);
34 }
35
36 function testDecorateOnceDirectly() {
37 var testElement = document.createElement('div');
Jeff Brown88448d92013-03-27 17:00:08 -070038 tracing.ui.decorate(testElement, TestElement);
Jamie Gennis2da489c2012-09-19 18:06:29 -070039 assertEquals(1, testElement.decorateCallCount);
40 }
41</script>
42</body>
43</html>