Esempio n. 1
0
 it('getDateTimeInstance works for noon', function () {
   var gregorianCalendar = new GregorianCalendar(zhCn);
   gregorianCalendar.set(2013,
     GregorianCalendar.JULY, 11, 12, 31, 19);
   var df = DateTimeFormat.getDateTimeInstance(Style.FULL, Style.FULL, require('../lib/locale/zh-cn'));
   expect(df.format(gregorianCalendar)).to.be('2013年7月11日 星期四 下午12时31分19秒 GMT+0800');
 });
Esempio n. 2
0
 it('throw error', function () {
   var gregorianCalendar = new GregorianCalendar();
   gregorianCalendar.set(2013, GregorianCalendar.JANUARY, 1);
   var df = new DateTimeFormat('yyyyMMddMMM');
   var str = '2013011Jan';
   expect(function () {
     df.parse(str);
   }).throwError(/GregorianCalendarFormat parse error/);
 });
Esempio n. 3
0
 it('works', function () {
   var gregorianCalendar = new GregorianCalendar();
   gregorianCalendar.set(2013, GregorianCalendar.JANUARY, 1);
   var df = new DateTimeFormat('yyyyMMddMMM');
   var str = '20130101Jan';
   var cal = df.parse(str);
   expect(cal.equals(gregorianCalendar)).to.be.ok();
   expect(df.format(cal)).to.be(str);
 });
Esempio n. 4
0
 it('en-us works', function () {
   var gregorianCalendar = new GregorianCalendar();
   gregorianCalendar.set(2013, GregorianCalendar.NOVEMBER, 1);
   var df = new DateTimeFormat('yyyy-MM-dd');
   var str = '2013-11-01';
   var cal = df.parse(str);
   expect(cal.equals(gregorianCalendar)).to.be.ok();
   expect(df.format(cal)).to.be(str);
 });
Esempio n. 5
0
 it('works simply', function () {
   var gregorianCalendar = new GregorianCalendar(zhCn);
   gregorianCalendar.set(2013,
     GregorianCalendar.JULY, 9);
   var df = new DateTimeFormat('yyyy-MM-dd');
   expect(df.format(gregorianCalendar)).to.be('2013-07-09');
   df = new DateTimeFormat('yy-MM-dd');
   expect(df.format(gregorianCalendar)).to.be('13-07-09');
 });
Esempio n. 6
0
 it('zh-cn simply works', function () {
   var gregorianCalendar = new GregorianCalendar(zhCn);
   gregorianCalendar.set(2013,
     GregorianCalendar.JULY, 11, 12, 31, 19);
   var df = DateTimeFormat.getDateTimeInstance(Style.FULL, Style.FULL, require('../lib/locale/zh-cn'));
   var str = '2013年7月11日 星期四 下午12时31分19秒 GMT+0800';
   var cal = df.parse(str, zhCn);
   expect(cal.equals(gregorianCalendar)).to.be.ok();
   expect(df.format(cal)).to.be(str);
 });
Esempio n. 7
0
}

function isEqTop(t1, t2) {
  return Math.abs(offsetTop(t1) - offsetTop(t2)) < 10;
}

function map$(node, fn) {
  const ret = [];
  for (let i = 0; i < node.length; i++) {
    ret.push(fn($(node[i])));
  }
  return ret;
}

const date = new GregorianCalendar(zhCn);
date.set(2014, 10, 16, 17, 30, 0);

describe('m-date-picker', () => {
  let div;
  let component;
  let rootDom;
  beforeEach(() => {
    div = document.createElement('div');
    document.body.appendChild(div);
    component = ReactDOM.render(
      <DatePicker locale={datePickerLocale} date={date} mode="datetime"/>, div);
    rootDom = $(ReactDOM.findDOMNode(component));
  });
  afterEach(() => {
    ReactDOM.unmountComponentAtNode(div);
    document.body.removeChild(div);