common.js (801B)
1 function assert_animations(filterFn, mappingFn, expected, message) { 2 const values = document.getAnimations() 3 .filter(filterFn) 4 .map(mappingFn); 5 const unique_values = [...new Set(values)].sort(); 6 7 const format = entries => entries.join(", "); 8 assert_equals(format(unique_values), format(expected), message); 9 } 10 11 function assert_animation_pseudos(element, expected, message) { 12 const filterFn = a => a.effect.target == element; 13 const mappingFn = a => a.effect.pseudoElement; 14 return assert_animations(filterFn, mappingFn, expected, message); 15 } 16 17 function assert_animation_names(target, expected, message) { 18 const filterFn = a => a.effect.pseudoElement == target; 19 const mappingFn = a => a.animationName; 20 return assert_animations(filterFn, mappingFn, expected, message); 21 }