gecko-dev/testing/web-platform/tests/web-animations/resources/keyframe-utils.js
Brian Birtles 45d82398fa Bug 1398038 - Use single quotes in keyframe-*.js; r=hiro
This is the generally preferred JS style these days and what we have been using
in more recent tests.

MozReview-Commit-ID: 9kir1D2Imqe

--HG--
extra : rebase_source : 5285761516abd2a902549bc98b8d3d7f7dfdc3eb
2017-10-18 14:12:16 +09:00

34 lines
1,003 B
JavaScript

'use strict';
// =======================================
//
// Utility functions for testing keyframes
//
// =======================================
// ------------------------------
// Helper functions
// ------------------------------
/**
* Test equality between two lists of computed keyframes
* @param {Array.<ComputedKeyframe>} a - actual computed keyframes
* @param {Array.<ComputedKeyframe>} b - expected computed keyframes
*/
function assert_frame_lists_equal(a, b) {
assert_equals(a.length, b.length, 'number of frames');
for (let i = 0; i < Math.min(a.length, b.length); i++) {
assert_frames_equal(a[i], b[i], `ComputedKeyframe #${i}`);
}
}
/** Helper for assert_frame_lists_equal */
function assert_frames_equal(a, b, name) {
assert_equals(Object.keys(a).sort().toString(),
Object.keys(b).sort().toString(),
`properties on ${name} should match`);
for (const p in a) {
assert_equals(a[p], b[p], `value for '${p}' on ${name}`);
}
}