瀏覽代碼

add some more tests

Adam Shaw 12 年之前
父節點
當前提交
2f6f8055b7
共有 2 個文件被更改,包括 43 次插入2 次删除
  1. 7 2
      tests/automated/fullCalendar.js
  2. 36 0
      tests/automated/moment-ambig.js

+ 7 - 2
tests/automated/fullCalendar.js

@@ -1,11 +1,16 @@
 
-describe('fullCalendar(Integration)', function() {
+describe('fullCalendar constructor', function() {
 
 	beforeEach(function() {
 		affix('#calendar');
 	});
 
-	describe('When fullCalendar() is called on a div', function() {
+	it('should return a jQuery object for chaining', function() {
+		var res = $('#calendar').fullCalendar();
+		expect(res instanceof jQuery).toBe(true);
+	});
+
+	describe('when called on a div', function() {
 
 		beforeEach(function() {
 			$('#calendar').fullCalendar();

+ 36 - 0
tests/automated/moment-ambig.js

@@ -0,0 +1,36 @@
+
+describe('ambiguously-timed moment', function() {
+
+	it('formats without a time and timezone part', function() {
+		var date = moment.utc('2014-01-01T06:00:00+00:00').stripTime();
+		var s = date.format();
+		expect(s).toEqual('2014-01-01');
+	});
+
+	it('is still ambuously-timed after being cloned', function() {
+		var date = moment('2014-01-01T06:00:00-07:00').stripTime();
+		var clone = date.clone();
+		expect(date.hasTime()).toEqual(false);
+		expect(clone.hasTime()).toEqual(false);
+	});
+
+});
+
+describe('ambiguously-zoned moment', function() {
+
+	it('formats without a timezone part', function() {
+		var date = moment.utc('2014-01-01T06:00:00+00:00').stripZone();
+		var s = date.format();
+		expect(s).toEqual('2014-01-01T06:00:00');
+	});
+
+	it('is still ambiguously-zoned after being cloned', function() {
+		var date = moment('2014-01-01T06:00:00-07:00').stripZone();
+		var clone = date.clone();
+		expect(date.hasZone()).toEqual(false);
+		expect(clone.hasZone()).toEqual(false);
+	});
+
+});
+
+// TODO: also for $.fullCalendar.moment() and calendar.moment()