scoutforpets / ember-fullcalendar

An Ember Component for FullCalendar and FullCalendar Scheduler
MIT License
39 stars 45 forks source link

replacing events rerenders events test fails #22

Closed rliebeskind closed 7 years ago

rliebeskind commented 8 years ago

using ember-cli: 2.5.0

PS C:\wrk\git\ember-fullcalendar> ember t Built project successfully. Stored in "C:\wrk\git\ember-fullcalendar\tmp\core_object-tests_dist-Dv0zock6.tmp". ok 1 Chrome 52.0 - JSHint | app.js: should pass jshint ok 2 Chrome 52.0 - JSHint | controllers/application.js: should pass jshint ok 3 Chrome 52.0 - JSHint | helpers/destroy-app.js: should pass jshint ok 4 Chrome 52.0 - JSHint | helpers/module-for-acceptance.js: should pass jshint ok 5 Chrome 52.0 - JSHint | helpers/resolver.js: should pass jshint ok 6 Chrome 52.0 - JSHint | helpers/start-app.js: should pass jshint ok 7 Chrome 52.0 - Integration | Component | full calendar: it renders ok 8 Chrome 52.0 - Integration | Component | full calendar: it renders events not ok 9 Chrome 52.0 - Integration | Component | full calendar: replacing events rerenders events

    actual: >
        3
    expected: >
        2
    stack: >
            at Object.<anonymous> (http://localhost:7357/assets/tests.js:304:12)
            at Object.wrapper (http://localhost:7357/assets/test-support.js:6634:29)
            at runTest (http://localhost:7357/assets/test-support.js:2779:28)
            at Object.run (http://localhost:7357/assets/test-support.js:2764:4)
            at http://localhost:7357/assets/test-support.js:2906:11
            at process (http://localhost:7357/assets/test-support.js:2565:24)
    Log: |
...

ok 10 Chrome 52.0 - Integration | Component | full calendar: set events to null removes events ok 11 Chrome 52.0 - Integration | Component | full calendar: it removes events ok 12 Chrome 52.0 - Integration | Component | full calendar: it adds events ok 13 Chrome 52.0 - JSHint | integration/components/full-calendar-test.js: should pass jshint ok 14 Chrome 52.0 - JSHint | resolver.js: should pass jshint ok 15 Chrome 52.0 - JSHint | router.js: should pass jshint ok 16 Chrome 52.0 - JSHint | test-helper.js: should pass jshint

1..16

tests 16

pass 15

skip 0

fail 1

Not all tests passed.

jamesdixon commented 8 years ago

Thanks for the report. What version of Ember is this failing against?

rliebeskind commented 8 years ago

Hi James,

I updated the issue. I am using ember-cli 2.5.0.

Sorry for the omission.

I am also having difficulty testing that events rendering my project. While I know it works already, the tests fail because the nodes I am locating are not found. I think it is an issue that I am checking too fast and need to give the jquery component time to render (assuming there are async processes going on here)? the test finds 0 elements when I expect it to find 3.

Today I plan to try to use a test-helper that waits for the elements to appear. Perhaps you have a better idea?

I am happy to submit this as an issue on npm if you prefer.

here is my test code:

test('it renders events', function (assert) { this.set('eventsArray', getEventsArray()); this.set('resourcesArray', getResourcesArray()); this.render(hbs{{planboard-calendar events=eventsArray resources=resourcesArray}}); let fcevents = this.$('.fc-event'); assert.equal(fcevents.length, 3); });

and here is my test data:

let getResourcesArray = () => { return Ember.A([ { id: 'a', title: '100' }, { id: 'b', title: '200' }, { id: 'c', title: '210' }, { id: 'd', title: '300' }, { id: 'lastrow', title: ' ' } ]); };

let getEventsArray = () => { return Ember.A([ { resourceId: 'a', //title : 'event1', start : '2016-08-09T05:30:00', end : '2016-08-09T06:30:00',
color : 'green', borderColor: 'blue', }, { resourceId: 'b', title : 'event2', start : '2016-08-09T07:30:00', end : '2016-08-09T09:30:00', color : 'red', borderColor: 'blue', planboard: { trolleys: { height: 10, width: 10, items: [ { id: 1, store: 100, tour: 9875, trolley_id: 665, features: {} },{ id: 2, store: 100, tour: 9875, trolley_id: 666, type: 'bread', timeStatus: 'on', capacityStatus: 'under', features: {}
}, { id: 3, store: 100, tour: 9875, trolley_id: 665, features: {} },{ id: 4, store: 100, tour: 9875, trolley_id: 666, type: 'bread', timeStatus: 'on', capacityStatus: 'under', features: {}
}

        ]
      }
    }
},
{
    resourceId: 'c',
    //title  : 'event3',
    start  : '2016-08-09T11:30:00',
    end    : '2016-08-09T12:30:00',
    color  : 'orange',
    borderColor: 'blue',
}

]); };

Regards, Rob.

On Aug 24, 2016, at 9:58 PM, James Dixon notifications@github.com wrote:

Thanks for the report. What version of Ember is this failing against?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/scoutforpets/ember-fullcalendar/issues/22#issuecomment-242188800, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnjAX-iLF8ar_NrK7zszpPZiodqwVK8ks5qjKJagaJpZM4JrxnE.

jamesdixon commented 8 years ago

@rliebeskind unfortunately I don't have the time to look into this, but more than willing to accept a PR! Thx!

jamesdixon commented 7 years ago

closed due to no response