2 * Copyright 2010-2013 Ben Birch
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this software except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 describe("app.ux.singleton", function(){
18 var Singleton = window.app.ux.Singleton;
20 describe("creating a singleton", function() {
21 var X = Singleton.extend({
27 var Y = Singleton.extend({
33 it("should have properties like a normal class", function() {
36 expect( a instanceof X ).toBe( true );
37 expect( a.foo() ).toBe( "bar" );
40 it("should return single instance each time instance() is called", function() {
44 expect( a ).toBe( b );
47 it("should not share instances with different singletons", function() {
51 expect( a ).not.toBe( c );