import { module, test, todo } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | bs datetimepicker', function(hooks) {
  setupRenderingTest(hooks);

  todo('it renders iconClasses and iconText', async function(assert) {
    assert.expect(2);

    await render(hbs`{{bs-datetimepicker date='2016-01-01' iconClasses='material-icons' iconText='date-range'}}`);

    assert.dom('.input-group-addon i').hasAttribute('class', 'material-icons');
    assert.dom('.input-group-addon i').hasText('date-range');
  });

  test('it renders with default icon classes', async function(assert) {
    assert.expect(1);

    await render(hbs`{{bs-datetimepicker date='2016-01-01'}}`);

    assert.dom('.input-group-addon i').hasAttribute('class', 'glyphicon glyphicon-calendar');
  });
});

@@ -18,14 +18,8 @@
 test
-, todo
  %7D f
@@ -96,16 +96,23 @@
 %7B render
+, focus
  %7D from 
@@ -290,11 +290,11 @@
 %0A  t
-odo
+est
 ('it
@@ -306,32 +306,242 @@
 ers 
-iconClasses and iconText
+basic input', async function(assert) %7B%0A    assert.expect(1);%0A%0A    await render(hbs%60%7B%7Bbs-datetimepicker date='2016-01-01'%7D%7D%60);%0A    assert.dom('input').hasValue('01/01/2016 12:00 AM');%0A  %7D);%0A%0A  test('it renders with default icon classes
 ', a
@@ -582,17 +582,17 @@
 .expect(
-2
+1
 );%0A%0A    
@@ -649,66 +649,350 @@
 -01'
- iconClasses='material-icons' iconText='date-range'
+%7D%7D%60);%0A    assert.dom('.input-group-addon i').hasAttribute('class', 'glyphicon glyphicon-calendar');%0A  %7D);%0A%0A  test('it renders calendar and time icon classes based on isTime argument', async function(assert) %7B%0A    assert.expect(2);%0A%0A    this.set('isTime', false);%0A%0A    await render(hbs%60%7B%7Bbs-datetimepicker date='2016-01-01' isTime=isTime
 %7D%7D%60);%0A
-%0A
     
@@ -1053,139 +1053,725 @@
 ', '
-material-icons');%0A    assert.dom('.input-group-addon i').hasText('date-range');%0A  %7D);%0A%0A  test('it renders wi
+glyphicon glyphicon-calendar');%0A    this.set('isTime', true);%0A    assert.dom('.input-group-addon i').hasAttribute('class', 'glyphicon glyphicon-time');%0A  %7D);%0A%0A  test('changing the value will trigger change action', async function(assert) %7B%0A    assert.expect(1);%0A%0A    const done = assert.async();%0A    this.set('callback', date =%3E %7B%0A      assert.equal(date.toISOString(), '2016-01-01T00:00:00.000Z');%0A      done();%0A    %7D);%0A    await render(hbs%60%7B%7Bbs-datetimepicker date=%221970-01-01%22 change=callback%7D%7D%60);%0A    // Set a new Date to trigger 
 th
+e
  d
-efault icon classes
+p.change event%0A    this.$('.input-group.date')%0A      .data('DateTimePicker')%0A      .date(new Date('2016-01-01'));%0A  %7D);%0A%0A  test('opens picker on focus when openOnFocus is enabled
 ', a
@@ -1867,117 +1867,150 @@
 ate=
-'2016
+%221970
 -01-01
-'%7D%7D%60);%0A%0A    assert.dom('.input-group-addon i').hasAttribute('class', 'glyphicon glyphicon-calendar
+%22 openOnFocus=true%7D%7D%60);%0A    await focus('input');%0A    assert.dom('.bootstrap-datetimepicker-widget').exists('picker should be shown
 ');%0A

Add more tests