All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.directive.cloak.cloak.spec.js Maven / Gradle / Ivy

import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
import { Angular } from "../../loader";
import { createInjector } from "../../core/di/injector";

describe("ngCloak", () => {
  let element;
  let $compile;
  let $rootScope;
  let injector;

  beforeEach(() => {
    window.angular = new Angular();
    injector = createInjector(["ng"]);
    $compile = injector.get("$compile");
    $rootScope = injector.get("$rootScope");
  });

  afterEach(() => {
    dealoc(element);
  });

  it("should get removed when an element is compiled", () => {
    element = JQLite("
"); expect(element.attr("ng-cloak")).toBe(""); $compile(element); expect(element.attr("ng-cloak")).toBeUndefined(); }); it("should remove ngCloak class from a compiled element with attribute", () => { element = JQLite('
'); expect(element[0].classList.contains("foo")).toBe(true); expect(element[0].classList.contains("ng-cloak")).toBe(true); expect(element[0].classList.contains("bar")).toBe(true); $compile(element); expect(element[0].classList.contains("foo")).toBe(true); expect(element[0].classList.contains("ng-cloak")).toBe(false); expect(element[0].classList.contains("bar")).toBe(true); }); });




© 2015 - 2025 Weber Informatics LLC | Privacy Policy