用角度编写require()的测试用例

时间:2019-04-03 10:48:54

标签: html angular image angular-components

由于我的测试失败,我添加了从组件中引用html中的svg图像的要求。请帮助我测试用例

declare var require: any;

@Component({
    selector: 'test',
    templateUrl: 'test.component.html',
    styleUrls: ['test.component.scss'],

})
export class TestComponent implements OnInit {

    referenceImage = require("./book.svg");

}

    <button mat-icon-button >
                <a class="reference-route" routerLink="reference" title="Reference">
                    <img class="reference-image" [src]="referenceImage" />
                </a>
    </button>

代码结构:

project
   ----------apps
       -------------test-frontend
           -------------src
               -------------assets
   ----------libs
        ----------shared
             ----------test
                ----------test.component.ts

0 个答案:

没有答案