Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Integration | Component | sl date time: Date values applied correctly" test failing in CI #1612

Open
notmessenger opened this issue Feb 27, 2016 · 0 comments

Comments

@notmessenger
Copy link
Collaborator

not ok 103 PhantomJS 1.9 - Integration | Component | sl date time: Date values applied correctly
    ---
        actual: >
            2015-11-26
        expected: >
            2015-11-27
        message: >
            Default date string matches default date pattern
        Log: |
    ...

I re-ran the build on CI several times and it kept failing. When I ran it again the next day (27 Feb 2016) it was passing again. Perhaps our logic approach is flawed?

This is when the content of the test case was:

test( 'Date values applied correctly', function( assert ) {

    const pastDateISO = window.moment().subtract( 3, 'months' ).toISOString();

    this.set( 'value', pastDateISO );

    this.render( hbs`
        {{sl-date-time
            format="date"
            timezone="America/Chicago"
            value=value
        }}
    ` );

    const pastRendered = this.$( '>:first-child' ).text().trim();
    const pastDate = window.moment().subtract( 3, 'months' );

    assert.strictEqual(
        pastRendered,
        pastDate.format( 'YYYY-MM-DD' ),
        'Default date string matches default date pattern'
    );

    const datetimeAttr = this.$( '>:first-child' ).attr( 'datetime' );
    const dataOriginalTitleAttr = this.$( '>:first-child' ).attr( 'data-original-title' );

    assert.strictEqual(
        datetimeAttr,
        dataOriginalTitleAttr,
        'Attributes datetime and data-original-title match'
    );

    assert.strictEqual(
        /^\d{4}[-]\d{2}[-]\d{2}\s\d{1,2}[:]\d{2}\s[A-Z]+$/.test( this.$( '>:first-child' ).attr( 'datetime' ) ),
        true,
        'Attribute datetime matches ISO datetime format plus timezone code'
    );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant