我是Qunit和单元测试的新手.
我试图找出测试以下功能的内容和方法.它目前没有做太多但我想断言如果我传递错误值的错误值:
function attrToggle (panel, attr) {
'use strict';
if (!panel) { throw new Error('Panel is not defined'); }
if (!attr) { throw new Error('Attr is not defined'); }
if (typeof panel !== 'string') { throw new Error('Panel is not a string'); }
if (typeof attr !== 'string') { throw new Error('Attr is not a string'); }
if (arguments.length !== 2) { throw new Error('There should be only two arguments passed to this function')}
};
Run Code Online (Sandbox Code Playgroud)
如果不满足任何这些条件,我该怎么断言会抛出错误?
我试着看看Qunit的'加注'断言但认为我误解了它.我的解释是,如果抛出错误,测试就会通过.
所以,如果我测试了这样的东西:
test("a test", …Run Code Online (Sandbox Code Playgroud) 这是非常常见的问题font-face,例如
font: 20px/20px 'ITC Avant Garde Gothic Std'; font-style: 'book'; letter-spacing: 1px; text-transform: uppercase;
Run Code Online (Sandbox Code Playgroud)

问题是我希望文本垂直居中.但事实并非如此.有没有办法抵消行高基线?没有实际改变line-height.