Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_animation_name.js

  Sprache: JAVA
 

/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test that AnimationActor.getName returns the right name depending on
// the type of an animation and the various properties available on it.

const {
  AnimationActor,
} = require("resource://devtools/server/actors/animation.js");

function run_test() {
  // Mock a window with just the properties the AnimationActor uses.
  const window = {};
  window.MutationObserver = class {
    constructor() {
      this.observe = () => {};
    }
  };
  window.Animation = class {
    constructor() {
      this.effect = { target: getMockNode() };
    }

    static isInstance(instance) {
      return instance instanceof this;
    }
  };

  window.CSSAnimation = class extends window.Animation {};
  window.CSSTransition = class extends window.Animation {};

  // Helper to get a mock DOM node.
  function getMockNode() {
    return {
      ownerDocument: {
        defaultView: window,
      },
    };
  }

  // Objects in this array should contain the following properties:
  // - desc {String} For logging
  // - animation {Object} An animation object instantiated from one of the mock
  //   window animation constructors.
  // - props {Objet} Properties of this object will be added to the animation
  //   object.
  // - expectedName {String} The expected name returned by
  //   AnimationActor.getName.
  const TEST_DATA = [
    {
      desc: "Animation with an id",
      animation: new window.Animation(),
      props: { id: "animation-id" },
      expectedName: "animation-id",
    },
    {
      desc: "Animation without an id",
      animation: new window.Animation(),
      props: {},
      expectedName: "",
    },
    {
      desc: "CSSTransition with an id",
      animation: new window.CSSTransition(),
      props: { id: "transition-with-id", transitionProperty: "width" },
      expectedName: "transition-with-id",
    },
    {
      desc: "CSSAnimation with an id",
      animation: new window.CSSAnimation(),
      props: { id: "animation-with-id", animationName: "move" },
      expectedName: "animation-with-id",
    },
    {
      desc: "CSSTransition without an id",
      animation: new window.CSSTransition(),
      props: { transitionProperty: "width" },
      expectedName: "width",
    },
    {
      desc: "CSSAnimation without an id",
      animation: new window.CSSAnimation(),
      props: { animationName: "move" },
      expectedName: "move",
    },
  ];

  for (const { desc, animation, props, expectedName } of TEST_DATA) {
    info(desc);
    for (const key in props) {
      animation[key] = props[key];
    }
    const actor = new AnimationActor({}, animation);
    Assert.equal(actor.getName(), expectedName);
  }
}

Messung V0.5 in Prozent
C=82 H=92 G=86

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002