我正在为使用angularJS使用Jasmine编写的SPA编写测试,测试的输出显示在html页面的底部,由于我的页面侧边栏而部分隐藏。我想要做的是将它们显示在屏幕内的特定位置,我尝试将测试部分放在特定的div中并更改div的位置,但它不起作用。我不想在控制台中显示测试的输出,我希望它们保留在主页面内,但是在我选择的特定位置。任何帮助表示赞赏。如果有人需要,我可以提供代码段。 谢谢
<div style="margin-left:30%;">
<script>
describe('test', function () {
beforeEach(module('myApp'));
var $controller;
beforeEach(inject(function (_$controller_) {
$controller = _$controller_;
}));
describe('deleteEntry', function () {
it('Entry should be deleted', function () {
var $scope = {};
var controller = $controller('movieCtrl', {$scope: $scope});
$scope.movies = [
{
"title": "The Shawshank Redemption",
"rank": "1",
"id": "tt0111161"
},
{
"title": "The Godfather",
"rank": "2",
"id": "tt0068646"
}
];
$scope.deleteEntry("1");
expect($scope.exists("The Shawshank Redemption")).toBe(false);
$scope.deleteEntry("2");
expect($scope.exists("The Godfather")).toBe(true);
});
});
describe('addEntry', function () {
it('Entry should be added', function () {
var $scope = {};
$scope.movies=[];
var controller = $controller('movieCtrl', {$scope: $scope});
$scope.addEntry("Testing Movie","1");
expect($scope.exists("Testing Movie")).toBe(true);
$scope.addEntry("Testing Movie Last","100");
expect($scope.exists("Testing Movie Last")).toBe(false);
});
});
});
</script>