Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions ChrisPerez/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@

<body data-ng-app="FirstApp">

<!-- <main ng-cloak ng-controller="FirstController as bunny">
<first-directive title="{{bunny.title}}" description="{{bunny.description}}" url="{{bunny.url}}"></first-directive>
<second-directive src="{{bunny.url}}" alt="{{bunny.description}}" width="{{bunny.width}}"></second-directive>
<third-directive src="{{bunny.url}}" alt="{{bunny.description}}" width="{{bunny.width}}"></third-directive>
</main> -->

<main ng-cloak ng-controller="AlbumController as albumctrl">
<div>
<h1>{{albumctrl.goatPics.title}}</h1>
Expand Down
1 change: 0 additions & 1 deletion ChrisPerez/app/js/first/directives/FirstDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ module.exports = function(app) {
url: '@'
}
};

});
};
1 change: 0 additions & 1 deletion ChrisPerez/app/js/first/directives/ThirdDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ module.exports = function(app) {
width: '@'
}
};

});
};
88 changes: 88 additions & 0 deletions ChrisPerez/test/directive_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ require('angular-mocks');
require('../app/js/client');

const firstTemplate = require('../app/templates/FirstApp/FirstTemplate.html');
const albumTemplate = require('../app/templates/FirstApp/AlbumTemplate.html');
const fullTemplate = require('../app/templates/FirstApp/FullTemplate.html');
const textTemplate = require('../app/templates/FirstApp/TextTemplate.html');

describe('directive tests', ()=>{
let $httpBackend;
Expand Down Expand Up @@ -49,4 +52,89 @@ describe('directive tests', ()=>{
expect(text2).toBe('Description: A test thing');
expect(text3).toBe('Source: test.jpg');
});

// it('should display an album', ()=>{
// $httpBackend.expectGET('./templates/FirstApp/AlbumTemplate.html')
// .respond(200, albumTemplate);
// $httpBackend.expectGET('./templates/FirstApp/FullTemplate.html')
// .respond(200, fullTemplate);
// //
//
// let testAlbum = [
// {
// label: 'label1',
// description: 'd1',
// url: '1.jpg',
// width: 100
// },
// {
// label: 'label2',
// description: 'd2',
// url: '2.jpg',
// width: 100
// },
// {
// label: 'label3',
// description: 'd3',
// url: '3.jpg',
// width: 100
// }
// ];
//
// let link = $compile(
// '<album-directive album="testAlbum"></album-directive>'
// );
// let directive = link($scope);
// $scope.$digest();
// $httpBackend.flush();
//
// console.log(directive);
// });

it('should provide album data', ()=>{
// $httpBackend.expectGET('./templates/FirstApp/AlbumTemplate.html')
// .respond(200, firstTemplate);
$httpBackend.expectGET('./templates/FirstApp/FullTemplate.html')
.respond(200, fullTemplate);
$scope.testAlbum = [
{
label: 'label1',
description: 'd1',
url: '1.jpg',
width: 100
},
{
label: 'label2',
description: 'd2',
url: '2.jpg',
width: 100
},
{
label: 'label3',
description: 'd3',
url: '3.jpg',
width: 100
}
];
let link = $compile(
'<album-directive album="testAlbum"></album-directive>'
);
let directive = link($scope);
$scope.$digest();
$httpBackend.flush();

// let h1 = directive.find('h1');
// let text1 = h1.text();
// let h2 = directive.find('h2');
// let text2 = h2.text();
// let h3 = directive.find('h3');
// let text3 = h3.text();
//
//
// expect(text1).toBe('Title: Test Title');
// expect(text2).toBe('Description: A test thing');
// expect(text3).toBe('Source: test.jpg');
console.log(directive);
});

});
Loading