Example #1
0
 it('few hours, less than day', function(){
     // 23 hours 59 min = 24 hours
     expect(view.nextSync(new Date(baseDate + 23 * HOUR + 59 * MINUTE)))
         .toEqual(i18n.t('model.time.in_hour', 24, [24]));
     // 1 hour 1 minuute = 1 hour
     expect(view.nextSync(new Date(baseDate + 1 * HOUR + 1 * MINUTE)))
         .toEqual(i18n.t('model.time.in_hour', 1, [1]));
 });
Example #2
0
 it('few months', function(){
     // 77 days = 2.48 months = 2 month
     expect(view.nextSync(new Date(baseDate + 77 * DAY)))
         .toEqual(i18n.t('model.time.in_month', 2, [2]));
     // 78 days = 2.51 months = 3 month
     expect(view.nextSync(new Date(baseDate + 78 * DAY + MINUTE)))
         .toEqual(i18n.t('model.time.in_month', 3, [3]));
 });
Example #3
0
 it('few days, less than week', function(){
     // 6 days 23 hours = 7 days
     expect(view.nextSync(new Date(baseDate + 6 * DAY + 23 * HOUR)))
         .toEqual(i18n.t('model.time.in_day', 7, [7]));
     // 1 day 1 min = 1 day
     expect(view.nextSync(new Date(baseDate + 1 * DAY + 1 * MINUTE)))
         .toEqual(i18n.t('model.time.in_day', 1, [1]));
 });
Example #4
0
 it('few weeks', function(){
     // 17 days = 2 weeks
     expect(view.nextSync(new Date(baseDate + 17 * DAY)))
         .toEqual(i18n.t('model.time.in_week', 2, [2]));
     // 18 days = 3 weeks
     expect(view.nextSync(new Date(baseDate + 18 * DAY)))
         .toEqual(i18n.t('model.time.in_week', 3, [3]));
     // 8 days = 1 week
     expect(view.nextSync(new Date(baseDate + 8 * DAY)))
         .toEqual(i18n.t('model.time.in_week', 1, [1]));
 });
Example #5
0
 it('few minutes, less than hour', function(){
     // 59 min 59 sec = 60 min
     expect(view.nextSync(new Date(baseDate + 59 * MINUTE + 59 * SECOND)))
         .toEqual(i18n.t('model.time.in_minute', 60, [60]));
     // 30 min 31 sec = 31 min
     expect(view.nextSync(new Date(baseDate + 30 * MINUTE + 31 * SECOND)))
         .toEqual(i18n.t('model.time.in_minute', 31, [31]));
     // 1 min 1 sec = 1 min
     expect(view.nextSync(new Date(baseDate + 1 * MINUTE + 1 * SECOND)))
         .toEqual(i18n.t('model.time.in_minute', 1, [1]));
 });
Example #6
0
        it('opens popup when click on "settings" label', function(){
            var $a = this.layout.$('tbody:first [data-action="settings"]');
            expect($a).toExist();
            $a.click();
            expect(this.layout.$('[data-region="popups"] .modal:visible')).toExist();

            var $form = this.layout.$('.modal:visible');
            expect($form).toExist();

            // reset all values to empty
            $form.find('[data-field="parameters.url"]').val('');
            $form.find('[data-field="parameters.timeout"]').val('');

            // reset parameters attribute of model
            this.syncController.sourceList.models[0].get('descriptor').set('parameters', {});

            // click Save button to validate form
            $form.find('[data-action="save"]').click();
            var emptyText = i18n.t('model.validator.required');
            expect($form.find('[data-field="parameters.url"]').closest('.control-group').find('.help-block')).toHaveText(emptyText);
            expect($form.find('[data-field="parameters.timeout"]').closest('.control-group').find('.help-block')).toHaveText(emptyText);
        });
Example #7
0
 it('year or more', function(){
     expect(view.nextSync(new Date(baseDate + YEAR + DAY)))
         .toEqual(i18n.t('model.time.in_infinite'));
 });
Example #8
0
 it('few seconds, less than minute', function(){
     // 59 sec = 59 sec
     expect(view.nextSync(new Date(baseDate + 59 * SECOND)))
         .toEqual(i18n.t('model.time.in_second', 59, [59]));
 });