Permalink
Browse files

alpha release

  • Loading branch information...
rhysbrettbowen committed Apr 4, 2012
1 parent 8506efe commit ecb0a731f5bd63b5fefb3252933752d6df5a5eda
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2009 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<title>Closure - All JsUnit Tests</title>
-<script src="closure-library/closure/goog/base.js"></script>
-<script src="alltests.js"></script>
-<script>
-goog.require('goog.userAgent.product');
-goog.require('goog.testing.MultiTestRunner');
-</script>
-<link rel="stylesheet" href="closure-library/closure/goog/css/multitestrunner.css" type="text/css">
-<style>
-h1 {
- font: normal x-large arial, helvetica, sans-serif;
- margin: 0;
-}
-p, form {
- font: normal small sans-serif;
- margin: 0;
-}
-#header {
- position: absolute;
- right: 10px;
- top: 13px;
-}
-#footer {
- margin-top: 8px;
-}
-a {
- text-decoration: none;
-}
-a:hover {
- text-decoration: underline;
-}
-.warning {
- font-size: 14px;
- font-weight: bold;
- width: 80%;
-}
-</style>
-</head>
-<body>
-
-<script>
- if (goog.userAgent.product.CHROME &&
- window.location.toString().indexOf('file:') == 0) {
- document.write(
- '<div class="warning">' +
- 'WARNING: Due to Chrome\'s security restrictions ' +
- 'this test will not be able to load files off your local disk ' +
- 'unless you start Chrome with:<br>' +
- '<code>--allow-file-access-from-files</code></div><br>');
- }
-</script>
-
-<h1>Closure - All JsUnit Tests</h1>
-<p id="header">
- <a href="http://wiki/Main/ClosureUnitTests">Closure JS Testing HOWTO</a>
-</p>
-<div id="runner"></div>
-<!-- Use a form so browser persists input values -->
-<form id="footer" onsubmit="return false">
- Settings:<br>
- <input type="checkbox" name="hidepasses" id="hidepasses" checked>
- <label for="hidepasses">Hide passes</label><br>
- <input type="checkbox" name="parallel" id="parallel" checked>
- <label for="parallel">Run in parallel</label>
- <small>(timing stats not available if enabled)</small><br>
- <input type="text" name="filter" id="filter" value="">
- <label for="filter">Run only tests for path</label>
-</form>
-<script>
- var hidePassesInput = document.getElementById('hidepasses');
- var parallelInput = document.getElementById('parallel');
- var filterInput = document.getElementById('filter');
-
- function setFilterFunction() {
- var matchValue = filterInput.value || '';
- testRunner.setFilterFunction(function(testPath) {
- return testPath.indexOf(matchValue) > -1;
- });
- }
-
- // Create a test runner and render it.
- var testRunner = new goog.testing.MultiTestRunner()
- .setName(document.title)
- .setBasePath('./')
- .setPoolSize(parallelInput.checked ? 8 : 1)
- .setStatsBucketSizes(5, 500)
- .setHidePasses(hidePassesInput.checked)
- //.setVerbosePasses(true)
- .addTests(_allTests);
- testRunner.render(document.getElementById('runner'));
-
- goog.events.listen(hidePassesInput, 'click', function(e) {
- testRunner.setHidePasses(e.target.checked);
- });
-
- goog.events.listen(parallelInput, 'click', function(e) {
- testRunner.setPoolSize(e.target.checked ? 8 : 1);
- });
-
- goog.events.listen(filterInput, 'keyup', setFilterFunction);
- setFilterFunction();
-</script>
-</body>
-</html>
@@ -1,22 +0,0 @@
-// Copyright 2009 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-var _allTests = [
- "collection_test.html",
- "control_test.html",
- "model_test.html",
- 'router_test.html',
- 'store_test.html',
- 'mediator_test.html'
-];
@@ -1,11 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Test for mvc.Collection</title>
-</head>
-<body>
- <script src="closure-library/closure/goog/base.js"></script>
- <script src="test_deps.js"></script>
- <script src="collection_test.js"></script>
-</body>
-</html>
@@ -1,51 +0,0 @@
-goog.require('mvc.Collection');
-goog.require('mvc.Model');
-
-goog.require('goog.testing.PropertyReplacer');
-goog.require('goog.testing.jsunit');
-
-/** @type {mvc.Model} */
-var model1, model2, model3;
-
-var setUp = function() {
- model1 = new mvc.Model({'sort':3});
- model2 = new mvc.Model({'sort':1});
- model3 = new mvc.Model({'sort':2});
-};
-
-var testUnsortedCollection = function() {
- var test = new mvc.Collection({'models':[model1, model2, model3]});
- assertEquals('first object should be mock 1', test.at(0), model1);
- assertEquals('second object should be mock 2', test.at(1), model2);
- assertEquals('third object should be mock 3', test.at(2), model3);
-};
-
-var testSortedCollection = function() {
- var sort = function(a, b) {return a.get('sort')-b.get('sort');};
- var test = new mvc.Collection();
- test.setComparator(sort);
- test.add(model1);
- assertEquals('first object should be mock 1', test.at(0), model1);
- test.add(model2);
- assertEquals('first object should be mock 2', test.at(0), model2);
- assertEquals('second object should be mock 1', test.at(1), model1);
- test.add(model3);
- assertEquals('first object should be mock 2', test.at(0), model2);
- assertEquals('second object should be mock 3', test.at(1), model3);
- assertEquals('third object should be mock 1', test.at(2), model1);
-};
-
-var testNewSortedCollection = function() {
- var sort = function(a, b) {return a.get('sort')-b.get('sort');};
- var test = new mvc.Collection({'models':[model1,model2,model3]});
- test.setComparator(sort);
- assertEquals('first object should be mock 2', test.at(0), model2);
- assertEquals('second object should be mock 3', test.at(1), model3);
- assertEquals('third object should be mock 1', test.at(2), model1);
-};
-
-var testAsModel = function() {
- var test = new mvc.Collection();
- test.set('a', 1);
- assertEquals('should have attribute a as 1', test.get('a'), 1);
-};
@@ -1,12 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Test for mvc.Control</title>
-</head>
-<body>
- <div id="control"><div id="test1" class="class1"><div id="test2" class="class2"><span id="test3" class="class1"></span></div></div></div>
- <script src="closure-library/closure/goog/base.js"></script>
- <script src="test_deps.js"></script>
- <script src="control_test.js"></script>
-</body>
-</html>
@@ -1,49 +0,0 @@
-goog.require('mvc.Control');
-goog.require('mvc.Model');
-
-goog.require('goog.dom');
-goog.require('goog.testing.jsunit');
-
-var simpleControl;
-
-var setUp = function() {
- simpleModel = new mvc.Model();
- simpleControl = new mvc.Control(simpleModel);
- simpleControl.decorate(goog.dom.getElement("control"));
-};
-
-var testSimpleControl = function() {
- assertEquals("should come back with one element", 1, simpleControl.getEls(".class2").length);
- assertEquals("should come back with 2 elements", 2, simpleControl.getEls(".class1").length);
-};
-
-var testControlListener = function () {
- var toggle = false;
- var handle = function(){toggle = !toggle;};
- var uid = simpleControl.click(handle);
- var evt = document.createEvent("MouseEvents");
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- simpleControl.getElement().dispatchEvent(evt);
- assert("true, click should be handled", toggle);
- simpleControl.off(uid);
- evt = document.createEvent("MouseEvents");
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- simpleControl.getElement().dispatchEvent(evt);
- assert("true, click listener should be removed", toggle);
-};
-
-var testControlOnce = function () {
- var toggle = false;
- var handle = function(){
- toggle = !toggle;
- };
- simpleControl.once(goog.events.EventType.CLICK, handle);
- var evt = document.createEvent("MouseEvents");
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- simpleControl.getElement().dispatchEvent(evt);
- assert("true, click should be handled", toggle);
- evt = document.createEvent("MouseEvents");
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- simpleControl.getElement().dispatchEvent(evt);
- assert("true, click listener should be removed", toggle);
-};
@@ -1,11 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Test for mvc.Mediator</title>
-</head>
-<body>
- <script src="closure-library/closure/goog/base.js"></script>
- <script src="test_deps.js"></script>
- <script src="mediator_test.js"></script>
-</body>
-</html>
@@ -1,32 +0,0 @@
-goog.require('mvc.Mediator');
-
-goog.require('goog.testing.jsunit');
-
-var med;
-var listen;
-
-var setUp = function() {
- med = new mvc.Mediator();
-};
-
-testRegister = function(){
- var a = {};
- med.register(a, ['test']);
- assertEquals(a, med.available_['test'][0]);
-};
-
-testUnregister = function() {
- var a = {};
- med.unregister(a, ['test']);
- assertUndefined(med.available_['test']);
-};
-
-testListen = function() {
- listen = med.on('test', function(){});
- assert(med.isListened('test'));
-};
-
-testUnlisten = function() {
- med.off(listen);
- assert(!med.isListened('test'));
-};
@@ -1,11 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Test for mvc.Model</title>
-</head>
-<body>
- <script src="closure-library/closure/goog/base.js"></script>
- <script src="test_deps.js"></script>
- <script src="model_test.js"></script>
-</body>
-</html>
@@ -1,51 +0,0 @@
-goog.require('mvc.Model');
-
-goog.require('goog.testing.jsunit');
-
-var simpleModel;
-var emptyModel;
-
-var setUp = function() {
- simpleModel = new mvc.Model({attr:
- {'a':'exists'}});
- emptyModel = new mvc.Model();
-};
-
-var testSimpleModel = function() {
- assertNotNullNorUndefined("New model created", simpleModel);
- assertEquals("Should be able to get 'a'", simpleModel.get('a'), 'exists');
- assertUndefined("Should return undefined", simpleModel.get('b'));
- simpleModel.set('a', 'changed');
- assertEquals("Should be able to change 'a'", simpleModel.get('a'), 'changed');
- simpleModel.set('b', 'new');
- assertEquals("Should be able to add new attribute 'b'", simpleModel.get('b'), 'new');
- simpleModel.unset('b');
- assertUndefined("Should be able to remove attribute 'b'", simpleModel.get('b'));
-};
-
-var testEmptyModel = function() {
- assertNotNull(emptyModel);
-};
-
-var testAlias = function() {
- simpleModel.set('date', {day:1,month:1});
- simpleModel.alias('1jan2010', 'date');
- assertEquals(simpleModel.get('1jan2010'), simpleModel.get('date'));
-};
-
-var testFormat = function() {
- simpleModel.set('date', {day:1,month:1});
- simpleModel.format('date', function(date) {
- return date.day+"/"+date.month;
- });
- assertEquals(simpleModel.get('date'), "1/1");
-};
-
-var testMeta = function() {
- simpleModel.set('day',1);
- simpleModel.set('month',1);
- simpleModel.meta('jan1', ['day', 'month'], function(day, month) {
- return day+"/"+month;
- });
- assertEquals(simpleModel.get('jan1'),"1/1");
-};
@@ -1,15 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Test for mvc.Router</title>
-</head>
-<body>
- <script src="closure-library/closure/goog/base.js"></script>
- <script src="test_deps.js"></script>
- <script>
- goog.require('goog.testing.ContinuationTestCase');
- goog.require('goog.testing.jsunit');
- </script>
- <script src="router_test.js"></script>
-</body>
-</html>
Oops, something went wrong.

0 comments on commit ecb0a73

Please sign in to comment.