1 describe("Ext", function() {
3 describe("Ext.apply", function() {
6 beforeEach(function() {
12 this.myMethodCalled = true;
14 toString: function() {
15 this.myToStringCalled = true;
20 it("should copy normal properties", function() {
24 otherThing: 'not cool',
28 expect(origin.name).toEqual('newName');
29 expect(origin.items).toEqual([4,5,6]);
30 expect(origin.something).toEqual('cool');
31 expect(origin.otherThing).toEqual('not cool');
32 expect(origin.isCool).toEqual(false);
35 it("should copy functions", function() {
38 this.newMethodCalled = true;
44 expect(origin.myMethodCalled).not.toBeDefined();
45 expect(origin.newMethodCalled).toBeTruthy();
48 it("should copy non-enumerables", function() {
50 toString: function() {
51 this.newToStringCalled = true;
57 expect(origin.myToStringCalled).not.toBeDefined();
58 expect(origin.newToStringCalled).toBeTruthy();
61 it("should apply properties and return an object", function() {
73 it("should change the reference of the object", function() {
86 it("should overwrite properties", function() {
102 it("should use default", function() {
120 it("should override all defaults", function() {
135 it("should return null if null is passed as first argument", function() {
136 expect(Ext.apply(null, {})).toBeNull();
139 it("should return the object if second argument is no defined", function() {
143 expect(Ext.apply(o)).toEqual(o);
146 it("should override valueOf", function() {
147 o = Ext.apply({}, {valueOf: 1});
149 expect(o.valueOf).toEqual(1);
152 it("should override toString", function() {
153 o = Ext.apply({}, {toString: 3});
155 expect(o.toString).toEqual(3);
160 describe("Ext.applyIf", function(){
163 it("should apply properties and return an object with an empty destination object", function() {
164 o = Ext.applyIf({}, {
175 it("should not override default properties", function() {
187 it("should not override default properties with mixing properties", function() {
203 it("should change the reference of the object", function() {
216 it("should return null if null is passed as first argument", function() {
217 expect(Ext.applyIf(null, {})).toBeNull();
220 it("should return the object if second argument is no defined", function() {
225 expect(Ext.applyIf(o)).toEqual(o);
230 describe("Ext.extend", function() {
231 var Dude, Awesome, david;
233 beforeEach(function() {
234 Dude = Ext.extend(Object, {
235 constructor: function(config){
236 Ext.apply(this, config);
237 this.isBadass = false;
241 Awesome = Ext.extend(Dude, {
242 constructor: function(){
243 Awesome.superclass.constructor.apply(this, arguments);
244 this.isBadass = true;
248 david = new Awesome({
253 it("should throw an error if superclass isn't defined", function() {
255 Ext.extend(undefined, {});
256 }).toRaiseExtError("Attempting to extend from a class which has not been loaded on the page.");
259 it("should create a superclass that return the original classe", function() {
260 expect(david.superclass).toEqual(Dude.prototype);
263 it("should add override method", function() {
264 expect(typeof david.override === 'function').toBe(true);
267 it("should override redefined methods", function() {
268 expect(david.isBadass).toBe(true);
271 it("should keep new properties", function() {
272 expect(david.davis).toEqual('isAwesome');
276 describe("Ext.override", function(){
280 beforeEach(function(){
281 Dude = function(){}; // avoid to directly override Object class
282 extApplySpy = spyOn(Ext, "apply");
285 it("should apply override", function(){
286 var override = {foo: true};
288 Ext.override(Dude, override);
290 expect(extApplySpy).toHaveBeenCalledWith(Dude.prototype, override);
294 describe("Ext.typeOf", function() {
295 it("should return null", function() {
296 expect(Ext.typeOf(null)).toEqual('null');
298 it("should return undefined", function() {
299 expect(Ext.typeOf(undefined)).toEqual('undefined');
301 it("should return undefined", function() {
302 expect(Ext.typeOf(window.someWeirdPropertyThatDoesntExist)).toEqual('undefined');
304 it("should return string", function() {
305 expect(Ext.typeOf('')).toEqual('string');
307 it("should return string", function() {
308 expect(Ext.typeOf('something')).toEqual('string');
310 it("should return string", function() {
311 expect(Ext.typeOf('1.2')).toEqual('string');
313 it("should return number", function() {
314 expect(Ext.typeOf(1)).toEqual('number');
316 it("should return number", function() {
317 expect(Ext.typeOf(1.2)).toEqual('number');
319 it("should return boolean", function() {
320 expect(Ext.typeOf(true)).toEqual('boolean');
322 it("should return boolean", function() {
323 expect(Ext.typeOf(false)).toEqual('boolean');
325 it("should return array", function() {
326 expect(Ext.typeOf([1,2,3])).toEqual('array');
328 it("should return array", function() {
329 expect(Ext.typeOf(new Array(1,2,3))).toEqual('array');
331 it("should return function 1", function() {
332 expect(Ext.typeOf(function(){})).toEqual('function');
334 // Don't run this test in IE
335 if (typeof alert === 'function') {
336 it("should return function 2", function() {
337 expect(Ext.typeOf(prompt)).toEqual('function');
340 it("should return function 3", function() {
341 expect(Ext.typeOf(new Function())).toEqual('function');
343 it("should return regexp 1", function() {
344 expect(Ext.typeOf(/test/)).toEqual('regexp');
346 it("should return regexp 2", function() {
347 expect(Ext.typeOf(new RegExp('test'))).toEqual('regexp');
349 it("should return date", function() {
350 expect(Ext.typeOf(new Date())).toEqual('date');
352 it("should return textnode", function() {
353 expect(Ext.typeOf(document.createTextNode('tada'))).toEqual('textnode');
355 it("should return whitespace", function() {
356 expect(Ext.typeOf(document.createTextNode(' '))).toEqual('whitespace');
358 it("should return whitespace", function() {
359 expect(Ext.typeOf(document.createTextNode(' '))).toEqual('whitespace');
361 it("should return element", function() {
362 expect(Ext.typeOf(document.getElementsByTagName('body')[0])).toEqual('element');
364 it("should return element", function() {
365 expect(Ext.typeOf(document.createElement('button'))).toEqual('element');
367 it("should return element", function() {
368 expect(Ext.typeOf(new Image())).toEqual('element');
370 it("should return object 1", function() {
371 expect(Ext.typeOf({some: 'stuff'})).toEqual('object');
373 it("should return object 2", function() {
374 expect(Ext.typeOf(new Object())).toEqual('object');
376 it("should return object 3", function() {
377 expect(Ext.typeOf(window)).toEqual('object');
379 it("should return boolean", function() {
380 expect(Ext.typeOf(new Boolean(true))).toEqual('boolean');
382 it("should return number", function() {
383 expect(Ext.typeOf(new Number(1.2))).toEqual('number');
387 describe("Ext.isIterable", function() {
388 it("should return true with empty array", function() {
389 expect(Ext.isIterable([])).toBe(true);
392 it("should return true with filled array", function() {
393 expect(Ext.isIterable([1, 2, 3, 4])).toBe(true);
396 it("should return false with boolean true", function() {
397 expect(Ext.isIterable(true)).toBe(false);
400 it("should return false with boolean false", function() {
401 expect(Ext.isIterable(false)).toBe(false);
404 it("should return false with string", function() {
405 expect(Ext.isIterable("foo")).toBe(false);
408 it("should return false with empty string", function() {
409 expect(Ext.isIterable("")).toBe(false);
412 it("should return false with number", function() {
413 expect(Ext.isIterable(1)).toBe(false);
416 it("should return false with null", function() {
417 expect(Ext.isIterable(null)).toBe(false);
420 it("should return false with undefined", function() {
421 expect(Ext.isIterable(undefined)).toBe(false);
424 it("should return false with date", function() {
425 expect(Ext.isIterable(new Date())).toBe(false);
428 it("should return false with empty object", function() {
429 expect(Ext.isIterable({})).toBe(false);
432 it("should return true with node list", function() {
433 expect(Ext.isIterable(document.getElementsByTagName('body'))).toBe(true);
436 it("should return true with html collection", function() {
437 expect(Ext.isIterable(document.images)).toBe(true);
441 describe("Ext.isArray", function() {
442 it("should return true with empty array", function() {
443 expect(Ext.isArray([])).toBe(true);
446 it("should return true with filled array", function() {
447 expect(Ext.isArray([1, 2, 3, 4])).toBe(true);
450 it("should return false with boolean true", function() {
451 expect(Ext.isArray(true)).toBe(false);
454 it("should return false with boolean false", function() {
455 expect(Ext.isArray(false)).toBe(false);
458 it("should return false with string", function() {
459 expect(Ext.isArray("foo")).toBe(false);
462 it("should return false with empty string", function() {
463 expect(Ext.isArray("")).toBe(false);
466 it("should return false with number", function() {
467 expect(Ext.isArray(1)).toBe(false);
470 it("should return false with null", function() {
471 expect(Ext.isArray(null)).toBe(false);
474 it("should return false with undefined", function() {
475 expect(Ext.isArray(undefined)).toBe(false);
478 it("should return false with date", function() {
479 expect(Ext.isArray(new Date())).toBe(false);
482 it("should return false with empty object", function() {
483 expect(Ext.isArray({})).toBe(false);
486 it("should return false with node list", function() {
487 expect(Ext.isArray(document.getElementsByTagName('body'))).toBe(false);
490 it("should return false with custom class that has a length property", function() {
491 var C = Ext.extend(Object, {
494 expect(Ext.isArray(new C())).toBe(false);
497 //it("should return false with element", function() {
498 // expect(Ext.isElement(Ext.getBody().dom)).toBe(false);
502 describe("Ext.isBoolean", function() {
503 it("should return false with empty array", function() {
504 expect(Ext.isBoolean([])).toBe(false);
507 it("should return false with filled array", function() {
508 expect(Ext.isBoolean([1, 2, 3, 4])).toBe(false);
511 it("should return true with boolean true", function() {
512 expect(Ext.isBoolean(true)).toBe(true);
515 it("should return true with boolean false", function() {
516 expect(Ext.isBoolean(false)).toBe(true);
519 it("should return false with string", function() {
520 expect(Ext.isBoolean("foo")).toBe(false);
523 it("should return false with empty string", function() {
524 expect(Ext.isBoolean("")).toBe(false);
527 it("should return false with number", function() {
528 expect(Ext.isBoolean(1)).toBe(false);
531 it("should return false with null", function() {
532 expect(Ext.isBoolean(null)).toBe(false);
535 it("should return false with undefined", function() {
536 expect(Ext.isBoolean(undefined)).toBe(false);
539 it("should return false with date", function() {
540 expect(Ext.isBoolean(new Date())).toBe(false);
543 it("should return false with empty object", function() {
544 expect(Ext.isBoolean({})).toBe(false);
547 it("should return false with node list", function() {
548 expect(Ext.isBoolean(document.getElementsByTagName('body'))).toBe(false);
551 //it("should return false with element", function() {
552 // expect(Ext.isElement(Ext.getBody().dom)).toBe(false);
556 describe("Ext.isDate", function() {
557 it("should return false with empty array", function() {
558 expect(Ext.isDate([])).toBe(false);
561 it("should return false with filled array", function() {
562 expect(Ext.isDate([1, 2, 3, 4])).toBe(false);
565 it("should return false with boolean true", function() {
566 expect(Ext.isDate(true)).toBe(false);
569 it("should return false with boolean false", function() {
570 expect(Ext.isDate(false)).toBe(false);
573 it("should return false with string", function() {
574 expect(Ext.isDate("foo")).toBe(false);
577 it("should return false with empty string", function() {
578 expect(Ext.isDate("")).toBe(false);
581 it("should return false with number", function() {
582 expect(Ext.isDate(1)).toBe(false);
585 it("should return false with null", function() {
586 expect(Ext.isDate(null)).toBe(false);
589 it("should return false with undefined", function() {
590 expect(Ext.isDate(undefined)).toBe(false);
593 it("should return true with date", function() {
594 expect(Ext.isDate(new Date())).toBe(true);
597 it("should return false with empty object", function() {
598 expect(Ext.isDate({})).toBe(false);
601 it("should return false with node list", function() {
602 expect(Ext.isDate(document.getElementsByTagName('body'))).toBe(false);
605 it("should return false with element", function() {
606 expect(Ext.isDate(Ext.getBody().dom)).toBe(false);
610 describe("Ext.isDefined", function() {
611 it("should return true with empty array", function() {
612 expect(Ext.isDefined([])).toBe(true);
615 it("should return true with filled array", function() {
616 expect(Ext.isDefined([1, 2, 3, 4])).toBe(true);
619 it("should return true with boolean true", function() {
620 expect(Ext.isDefined(true)).toBe(true);
623 it("should return true with boolean false", function() {
624 expect(Ext.isDefined(false)).toBe(true);
627 it("should return true with string", function() {
628 expect(Ext.isDefined("foo")).toBe(true);
631 it("should return true with empty string", function() {
632 expect(Ext.isDefined("")).toBe(true);
635 it("should return true with number", function() {
636 expect(Ext.isDefined(1)).toBe(true);
639 it("should return true with null", function() {
640 expect(Ext.isDefined(null)).toBe(true);
643 it("should return false with undefined", function() {
644 expect(Ext.isDefined(undefined)).toBe(false);
647 it("should return true with date", function() {
648 expect(Ext.isDefined(new Date())).toBe(true);
651 it("should return true with empty object", function() {
652 expect(Ext.isDefined({})).toBe(true);
655 it("should return true with node list", function() {
656 expect(Ext.isDefined(document.getElementsByTagName('body'))).toBe(true);
659 //it("should return true with element", function() {
660 // expect(Ext.isElement(Ext.getBody().dom)).toBe(true);
664 describe("Ext.isElement", function() {
665 it("should return false with empty array", function() {
666 expect(Ext.isElement([])).toBe(false);
669 it("should return false with filled array", function() {
670 expect(Ext.isElement([1, 2, 3, 4])).toBe(false);
673 it("should return false with boolean true", function() {
674 expect(Ext.isElement(true)).toBe(false);
677 it("should return false with boolean false", function() {
678 expect(Ext.isElement(false)).toBe(false);
681 it("should return false with string", function() {
682 expect(Ext.isElement("foo")).toBe(false);
685 it("should return false with empty string", function() {
686 expect(Ext.isElement("")).toBe(false);
689 it("should return false with number", function() {
690 expect(Ext.isElement(1)).toBe(false);
693 it("should return false with null", function() {
694 expect(Ext.isElement(null)).toBe(false);
697 it("should return false with undefined", function() {
698 expect(Ext.isElement(undefined)).toBe(false);
701 it("should return false with date", function() {
702 expect(Ext.isElement(new Date())).toBe(false);
705 it("should return false with empty object", function() {
706 expect(Ext.isElement({})).toBe(false);
709 it("should return false with node list", function() {
710 expect(Ext.isElement(document.getElementsByTagName('body'))).toBe(false);
713 //it("should return true with element", function() {
714 // expect(Ext.isElement(Ext.getBody().dom)).toBe(true);
717 //it("should return false with Ext.core.Element", function() {
718 // expect(Ext.isElement(Ext.getBody().dom)).toBe(true);
722 describe("Ext.isEmpty", function() {
723 it("should return true with empty array", function() {
724 expect(Ext.isEmpty([])).toBe(true);
727 it("should return false with filled array", function() {
728 expect(Ext.isEmpty([1, 2, 3, 4])).toBe(false);
731 it("should return false with boolean true", function() {
732 expect(Ext.isEmpty(true)).toBe(false);
735 it("should return false with boolean false", function() {
736 expect(Ext.isEmpty(false)).toBe(false);
739 it("should return false with string", function() {
740 expect(Ext.isEmpty("foo")).toBe(false);
743 it("should return true with empty string", function() {
744 expect(Ext.isEmpty("")).toBe(true);
747 it("should return true with empty string with allowBlank", function() {
748 expect(Ext.isEmpty("", true)).toBe(false);
751 it("should return false with number", function() {
752 expect(Ext.isEmpty(1)).toBe(false);
755 it("should return true with null", function() {
756 expect(Ext.isEmpty(null)).toBe(true);
759 it("should return true with undefined", function() {
760 expect(Ext.isEmpty(undefined)).toBe(true);
763 it("should return false with date", function() {
764 expect(Ext.isEmpty(new Date())).toBe(false);
767 it("should return false with empty object", function() {
768 expect(Ext.isEmpty({})).toBe(false);
772 describe("Ext.isFunction", function() {
773 beforeEach(function() {
774 // add global variable in whitelist
775 addGlobal("ExtSandbox1");
778 it("should return true with anonymous function", function() {
779 expect(Ext.isFunction(function(){})).toBe(true);
782 it("should return true with new Function syntax", function() {
783 expect(Ext.isFunction(Ext.functionFactory('return "";'))).toBe(true);
786 it("should return true with static function", function() {
787 expect(Ext.isFunction(Ext.emptyFn)).toBe(true);
790 it("should return true with instance function", function() {
791 var stupidClass = function() {},
793 stupidClass.prototype.testMe = function() {};
794 testObject = new stupidClass();
796 expect(Ext.isFunction(testObject.testMe)).toBe(true);
799 it("should return true with function on object", function() {
805 expect(Ext.isFunction(o.fn)).toBe(true);
808 it("should return false with empty array", function() {
809 expect(Ext.isFunction([])).toBe(false);
812 it("should return false with filled array", function() {
813 expect(Ext.isFunction([1, 2, 3, 4])).toBe(false);
816 it("should return false with boolean true", function() {
817 expect(Ext.isFunction(true)).toBe(false);
820 it("should return false with boolean false", function() {
821 expect(Ext.isFunction(false)).toBe(false);
824 it("should return false with string", function() {
825 expect(Ext.isFunction("foo")).toBe(false);
828 it("should return false with empty string", function() {
829 expect(Ext.isFunction("")).toBe(false);
832 it("should return false with number", function() {
833 expect(Ext.isFunction(1)).toBe(false);
836 it("should return false with null", function() {
837 expect(Ext.isFunction(null)).toBe(false);
840 it("should return false with undefined", function() {
841 expect(Ext.isFunction(undefined)).toBe(false);
844 it("should return false with date", function() {
845 expect(Ext.isFunction(new Date())).toBe(false);
848 it("should return false with empty object", function() {
849 expect(Ext.isFunction({})).toBe(false);
852 it("should return false with node list", function() {
853 expect(Ext.isFunction(document.getElementsByTagName('body'))).toBe(false);
857 describe("Ext.isNumber", function() {
858 it("should return true with zero", function() {
859 expect(Ext.isNumber(0)).toBe(true);
862 it("should return true with non zero", function() {
863 expect(Ext.isNumber(4)).toBe(true);
866 it("should return true with negative integer", function() {
867 expect(Ext.isNumber(-3)).toBe(true);
870 it("should return true with float", function() {
871 expect(Ext.isNumber(1.75)).toBe(true);
874 it("should return true with negative float", function() {
875 expect(Ext.isNumber(-4.75)).toBe(true);
878 it("should return true with Number.MAX_VALUE", function() {
879 expect(Ext.isNumber(Number.MAX_VALUE)).toBe(true);
882 it("should return true with Number.MIN_VALUE", function() {
883 expect(Ext.isNumber(Number.MIN_VALUE)).toBe(true);
886 it("should return true with Math.PI", function() {
887 expect(Ext.isNumber(Math.PI)).toBe(true);
890 it("should return true with Number() contructor", function() {
891 expect(Ext.isNumber(Number('3.1'))).toBe(true);
894 it("should return false with NaN", function() {
895 expect(Ext.isNumber(Number.NaN)).toBe(false);
898 it("should return false with Number.POSITIVE_INFINITY", function() {
899 expect(Ext.isNumber(Number.POSITIVE_INFINITY)).toBe(false);
902 it("should return false with Number.NEGATIVE_INFINITY", function() {
903 expect(Ext.isNumber(Number.NEGATIVE_INFINITY)).toBe(false);
906 it("should return false with empty array", function() {
907 expect(Ext.isNumber([])).toBe(false);
910 it("should return false with filled array", function() {
911 expect(Ext.isNumber([1, 2, 3, 4])).toBe(false);
914 it("should return false with boolean true", function() {
915 expect(Ext.isNumber(true)).toBe(false);
918 it("should return false with boolean false", function() {
919 expect(Ext.isNumber(false)).toBe(false);
922 it("should return false with string", function() {
923 expect(Ext.isNumber("foo")).toBe(false);
926 it("should return false with empty string", function() {
927 expect(Ext.isNumber("")).toBe(false);
930 it("should return false with string containing a number", function() {
931 expect(Ext.isNumber("1.0")).toBe(false);
934 it("should return false with undefined", function() {
935 expect(Ext.isNumber(undefined)).toBe(false);
938 it("should return false with date", function() {
939 expect(Ext.isNumber(new Date())).toBe(false);
942 it("should return false with empty object", function() {
943 expect(Ext.isNumber({})).toBe(false);
946 it("should return false with node list", function() {
947 expect(Ext.isNumber(document.getElementsByTagName('body'))).toBe(false);
951 describe("Ext.isObject", function() {
952 it("should return false with empty array", function() {
953 expect(Ext.isObject([])).toBe(false);
956 it("should return false with filled array", function() {
957 expect(Ext.isObject([1, 2, 3, 4])).toBe(false);
960 it("should return false with boolean true", function() {
961 expect(Ext.isObject(true)).toBe(false);
964 it("should return false with boolean false", function() {
965 expect(Ext.isObject(false)).toBe(false);
968 it("should return false with string", function() {
969 expect(Ext.isObject("foo")).toBe(false);
972 it("should return false with empty string", function() {
973 expect(Ext.isObject("")).toBe(false);
976 it("should return false with number", function() {
977 expect(Ext.isObject(1)).toBe(false);
980 it("should return false with null", function() {
981 expect(Ext.isObject(null)).toBe(false);
984 it("should return false with undefined", function() {
985 expect(Ext.isObject(undefined)).toBe(false);
988 it("should return false with date", function() {
989 expect(Ext.isObject(new Date())).toBe(false);
992 it("should return true with empty object", function() {
993 expect(Ext.isObject({})).toBe(true);
996 it("should return false with a DOM node", function() {
997 expect(Ext.isObject(document.body)).toBe(false);
1000 it("should return false with a Text node", function() {
1001 expect(Ext.isObject(document.createTextNode('test'))).toBe(false);
1004 it("should return true with object with properties", function() {
1005 expect(Ext.isObject({
1010 it("should return true with object instance", function() {
1011 var stupidClass = function() {};
1013 expect(Ext.isObject(new stupidClass())).toBe(true);
1016 it("should return true with new Object syntax", function() {
1017 expect(Ext.isObject(new Object())).toBe(true);
1020 it("should return false with dom element", function() {
1021 expect(Ext.isObject(document.body)).toBe(false);
1025 describe("Ext.isPrimitive", function() {
1026 it("should return true with integer", function() {
1027 expect(Ext.isPrimitive(1)).toBe(true);
1030 it("should return true with negative integer", function() {
1031 expect(Ext.isPrimitive(-21)).toBe(true);
1034 it("should return true with float", function() {
1035 expect(Ext.isPrimitive(2.1)).toBe(true);
1038 it("should return true with negative float", function() {
1039 expect(Ext.isPrimitive(-12.1)).toBe(true);
1042 it("should return true with Number.MAX_VALUE", function() {
1043 expect(Ext.isPrimitive(Number.MAX_VALUE)).toBe(true);
1046 it("should return true with Math.PI", function() {
1047 expect(Ext.isPrimitive(Math.PI)).toBe(true);
1050 it("should return true with empty string", function() {
1051 expect(Ext.isPrimitive("")).toBe(true);
1054 it("should return true with non empty string", function() {
1055 expect(Ext.isPrimitive("foo")).toBe(true);
1058 it("should return true with boolean true", function() {
1059 expect(Ext.isPrimitive(true)).toBe(true);
1062 it("should return true with boolean false", function() {
1063 expect(Ext.isPrimitive(false)).toBe(true);
1066 it("should return false with null", function() {
1067 expect(Ext.isPrimitive(null)).toBe(false);
1070 it("should return false with undefined", function() {
1071 expect(Ext.isPrimitive(undefined)).toBe(false);
1074 it("should return false with object", function() {
1075 expect(Ext.isPrimitive({})).toBe(false);
1078 it("should return false with object instance", function() {
1079 var stupidClass = function() {};
1080 expect(Ext.isPrimitive(new stupidClass())).toBe(false);
1083 it("should return false with array", function() {
1084 expect(Ext.isPrimitive([])).toBe(false);
1088 describe("Ext.isString", function() {
1089 it("should return true with empty string", function() {
1090 expect(Ext.isString("")).toBe(true);
1093 it("should return true with non empty string", function() {
1094 expect(Ext.isString("foo")).toBe(true);
1097 it("should return true with String() syntax", function() {
1098 expect(Ext.isString(String(""))).toBe(true);
1101 it("should return false with new String() syntax", function() { //should return an object that wraps the primitive
1102 expect(Ext.isString(new String(""))).toBe(false);
1105 it("should return false with number", function() {
1106 expect(Ext.isString(1)).toBe(false);
1109 it("should return false with boolean", function() {
1110 expect(Ext.isString(true)).toBe(false);
1113 it("should return false with null", function() {
1114 expect(Ext.isString(null)).toBe(false);
1117 it("should return false with undefined", function() {
1118 expect(Ext.isString(undefined)).toBe(false);
1121 it("should return false with array", function() {
1122 expect(Ext.isString([])).toBe(false);
1125 it("should return false with object", function() {
1126 expect(Ext.isString({})).toBe(false);
1130 describe("Ext.namespace", function() {
1133 it("should have an alias named ns", function() {
1134 expect(Ext.ns).toEqual(Ext.namespace);
1137 it("should create a single top level namespace", function() {
1138 Ext.namespace('FooTest1');
1140 expect(w.FooTest1).toBeDefined();
1142 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1143 w.FooTest1 = undefined;
1149 it("should create multiple top level namespace", function() {
1150 Ext.namespace('FooTest2', 'FooTest3', 'FooTest4');
1152 expect(w.FooTest2).toBeDefined();
1153 expect(w.FooTest3).toBeDefined();
1154 expect(w.FooTest4).toBeDefined();
1156 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1157 w.FooTest2 = undefined;
1158 w.FooTest3 = undefined;
1159 w.FooTest4 = undefined;
1167 it("should create a chain of namespaces, starting from a top level", function() {
1168 Ext.namespace('FooTest5', 'FooTest5.ns1', 'FooTest5.ns1.ns2', 'FooTest5.ns1.ns2.ns3');
1170 expect(w.FooTest5).toBeDefined();
1171 expect(w.FooTest5.ns1).toBeDefined();
1172 expect(w.FooTest5.ns1.ns2).toBeDefined();
1173 expect(w.FooTest5.ns1.ns2.ns3).toBeDefined();
1175 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1176 w.FooTest5 = undefined;
1182 it("should create lower level namespaces without first defining the top level", function() {
1183 Ext.namespace('FooTest6.ns1', 'FooTest7.ns2');
1185 expect(w.FooTest6).toBeDefined();
1186 expect(w.FooTest6.ns1).toBeDefined();
1187 expect(w.FooTest7).toBeDefined();
1188 expect(w.FooTest7.ns2).toBeDefined();
1190 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1191 w.FooTest6 = undefined;
1192 w.FooTest7 = undefined;
1199 it("should create a lower level namespace without defining the middle level", function() {
1200 Ext.namespace('FooTest8', 'FooTest8.ns1.ns2');
1202 expect(w.FooTest8).toBeDefined();
1203 expect(w.FooTest8.ns1).toBeDefined();
1204 expect(w.FooTest8.ns1.ns2).toBeDefined();
1206 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1207 w.FooTest8 = undefined;
1213 it ("should not overwritte existing namespace", function() {
1214 Ext.namespace('FooTest9');
1216 FooTest9.prop1 = 'foo';
1218 Ext.namespace('FooTest9');
1220 expect(FooTest9.prop1).toEqual("foo");
1222 if (jasmine.browser.isIE6 || jasmine.browser.isIE7 || jasmine.browser.isIE8) {
1223 w.FooTest9 = undefined;