{"size": 1143, "ext": "js", "max_stars_repo_path": "test/base/LanguageDirectionMixin.tests.js", "max_stars_repo_name": "doc22940/elix", "max_stars_repo_stars_event_min_datetime": "2020-03-04T23:52:44.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-04T23:52:44.000Z", "max_issues_repo_path": "test/base/LanguageDirectionMixin.tests.js", "max_issues_repo_name": "doc22940/elix", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/base/LanguageDirectionMixin.tests.js", "max_forks_repo_name": "doc22940/elix", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.6571428571, "max_line_length": 78, "alphanum_fraction": 0.697287839}
import { assert } from "../testHelpers.js";
import * as internal from "../../src/base/internal.js";
import LanguageDirectionMixin from "../../src/base/LanguageDirectionMixin.js";
import ReactiveElement from "../../src/core/ReactiveElement.js";

class LanguageDirectionTest extends LanguageDirectionMixin(ReactiveElement) {}
customElements.define("language-direction-test", LanguageDirectionTest);

describe("LanguageDirectionMixin", () => {
  let container;

  before(() => {
    container = document.getElementById("container");
  });

  afterEach(() => {
    container.innerHTML = "";
  });

  it("sets state.rightToLeft to false in left-to-right context", () => {
    const fixture = new LanguageDirectionTest();
    container.appendChild(fixture);
    assert(fixture[internal.state].rightToLeft === false);
  });

  it("sets state.rightToLeft to true in right-to-left context", () => {
    const fixture = new LanguageDirectionTest();
    const div = document.createElement("div");
    div.setAttribute("dir", "rtl");
    div.appendChild(fixture);
    container.appendChild(div);
    assert(fixture[internal.state].rightToLeft);
  });
});
