{"size": 701, "ext": "js", "max_stars_repo_path": "cypress/support/validators.js", "max_stars_repo_name": "lycaste/mattermost-webapp", "max_stars_repo_stars_event_min_datetime": "2019-08-13T04:54:16.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-06T15:05:18.000Z", "max_issues_repo_path": "cypress/support/validators.js", "max_issues_repo_name": "lycaste/mattermost-webapp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "cypress/support/validators.js", "max_forks_repo_name": "lycaste/mattermost-webapp", "max_forks_repo_forks_event_min_datetime": "2019-07-02T08:08:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-16T19:52:05.000Z"}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 38.9444444444, "max_line_length": 108, "alphanum_fraction": 0.6904422254}
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

/**
 * ellipsis validator permit to expect if an element is show with css ellipsis in DOM
 * Inspiration https://stackoverflow.com/a/19304167
 *
 * @param {boolean} shouldBe True to assert element should be ellipsis (display with '...'), False otherwise
 * @example cy.get('#myId').ellipsis(true)
 */
Cypress.Commands.add('ellipsis', {prevSubject: true}, (subject, shouldBe) => {
    if (shouldBe) {
        expect(subject.outerWidth()).lt(subject[0].scrollWidth);
    } else {
        expect(subject.outerWidth()).to.be.closeTo(subject[0].scrollWidth, 0.1);
    }
    return subject;
});