MCPcopy
hub / github.com/ampproject/amphtml / test

Function test

extensions/amp-animation/0.1/test/test-css-expr-resolve-calc.js:396–431  ·  view source on GitHub ↗
(name, argsOrFunc, css, results)

Source from the content-addressed store, hash-verified

394
395 describe('min/max/clamp', () => {
396 function test(name, argsOrFunc, css, results) {
397 it(`min: ${name}`, () => {
398 const args =
399 typeof argsOrFunc == 'function' ? argsOrFunc() : argsOrFunc;
400 const min = new ast.CssMinMaxNode('min', args);
401 expect(min.isConst()).to.be.false;
402 if (css) {
403 expect(min.css()).to.equal(`min(${css})`);
404 }
405 expect(resolvedCss(min)).to.equal(results[0]);
406 });
407
408 it(`max: ${name}`, () => {
409 const args =
410 typeof argsOrFunc == 'function' ? argsOrFunc() : argsOrFunc;
411 const max = new ast.CssMinMaxNode('max', args);
412 expect(max.isConst()).to.be.false;
413 if (css) {
414 expect(max.css()).to.equal(`max(${css})`);
415 }
416 expect(resolvedCss(max)).to.equal(results[1]);
417 });
418
419 if (results.length > 2) {
420 it(`clamp: ${name}`, () => {
421 const args =
422 typeof argsOrFunc == 'function' ? argsOrFunc() : argsOrFunc;
423 const clamp = new ast.CssMinMaxNode('clamp', args);
424 expect(clamp.isConst()).to.be.false;
425 if (css) {
426 expect(clamp.css()).to.equal(`clamp(${css})`);
427 }
428 expect(resolvedCss(clamp)).to.equal(results[2]);
429 });
430 }
431 }
432
433 it('should always consider as non-const', () => {
434 expect(ast.isVarCss('min(10px)')).to.be.true;

Callers 1

Calls 5

isConstMethod · 0.95
expectFunction · 0.85
resolvedCssFunction · 0.70
itFunction · 0.50
cssMethod · 0.45

Tested by

no test coverage detected