summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-animations/resources/timing-utils.js
blob: d7267f94f2df0ee502cb7e03166b653ce6a5bd92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';

// =======================================
//
// Utility functions for testing timing
//
// =======================================


// ------------------------------
//  Helper functions
// ------------------------------

// Utility function to check that a subset of timing properties have their
// default values.
function assert_default_timing_except(effect, propertiesToSkip) {
  const defaults = {
    delay: 0,
    endDelay: 0,
    fill: 'auto',
    iterationStart: 0,
    iterations: 1,
    duration: 'auto',
    direction: 'normal',
    easing: 'linear',
  };

  for (const prop of Object.keys(defaults)) {
    if (propertiesToSkip.includes(prop)) {
      continue;
    }

    assert_equals(
      effect.getTiming()[prop],
      defaults[prop],
      `${prop} parameter has default value:`
    );
  }
}