Skip to content

Commit

Permalink
Merge branch 'gh-pages' of https://github.com/plastic-cup/week-2-api
Browse files Browse the repository at this point in the history
…into gh-pages
  • Loading branch information
minaorangina committed May 22, 2015
2 parents 5bf18ad + 7d3d324 commit a55c032
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 23 deletions.
14 changes: 13 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,19 @@
top: 0px;
width: 100%;
height: 100%;
background: black;
background: rgba(0,0,0,0.8);
}

#close {
position: fixed;
top: 50px;
left: 940px;
height: 50px;
width: 50px;
background-color: rgba(0,0,0,0);
background-image: url('../images/close.png');
background-repeat: no-repeat;
background-position: center center;
}

.picChild {
Expand Down
Binary file added images/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions javascript/headers-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,16 @@ for (var i = 0; i < selectedPhotos.length; i++){
function lightbox(){
var darkness = document.createElement('div');
var lightbox = document.createElement('img');
var close = document.createElement('div');
close.setAttribute('id', 'close');
var fullSize = this.src.split('/');
fullSize.splice(5,1);
fullSize = fullSize.join('/');
lightbox.setAttribute('id', 'lightbox');
lightbox.setAttribute('src', fullSize);
filterpage.appendChild(darkness);
darkness.appendChild(lightbox);
darkness.appendChild(close);
darkness.setAttribute('class', 'darkened');
darkness.addEventListener('click', function(){
darkness.parentNode.removeChild(darkness);
Expand Down
62 changes: 40 additions & 22 deletions javascript/tests.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
test('the photos on the page change',function(assert){
var iframe = document.getElementById('iframe');
var target = iframe.contentDocument || iframe.contentWindow.document;
var photosAtFirst = target.getElementById('photo-grid');
var photosAtFirst = [].slice.call(target.getElementsByClassName('pics')).map(function(element){
return element.firstChild;
});
var done = assert.async();
setTimeout(function(){
var photosNow = target.getElementById('photo-grid');
var photosNow = [].slice.call(target.getElementsByClassName('pics')).map(function(element){
return element.firstChild;
});
notEqual(photosAtFirst,photosNow);
done();
},1000);
},6000);
});

test("Testthere an image on the page", function(){
test("Testthere an image on the page", function(assert){
var iframe = document.getElementById('iframe');
var target = iframe.contentDocument || iframe.contentWindow.document;
var image = target.getElementsByTagName("img")[0].src;

notEqual(image, "", "Woop Well done dyyyd");
var done = assert.async();
setTimeout(function(){
var image = target.getElementsByTagName("img")[0].src;
notEqual(image, "", "Woop Well done dyyyd");
done();
},200)


});

Expand Down Expand Up @@ -51,35 +60,44 @@ updateTag(newTag);
});


test("Test does the var tag change when hit find", function(){
test("Test does the var tag change when hit find", function(assert){

var iframe =document.getElementById('iframe');
var target = iframe.contentDocument || iframe.contentWindow.document;

var tag1 = target.document.getElementById("input").value;
target.getElementsByTagName('button').onclick();
var tag2 = target.document.getElementById("input").value;
var done = assert.async();

var tag1= target.tag;
var tag2;

notEqual(tag2, tag1, "Successs");
setTimeout(function(){

});
target.getElementsByTagName('button')[0].click();
;
},6000)

setTimeout(function(){
tag2 = target.getElementById("input").value;
console.log(tag2);
notEqual(tag2, tag1, "Successs");
done();
},8000)



});


test("old pics get deleted",function(assert){
var done = assert.async();
var iframe = document.getElementById('iframe');
var target = iframe.contentDocument || iframe.contentWindow.document;
setTimeout(function(){
var photosAtFirst = target.getElementById('photo-grid');
setTimeout(function(){
var photosNow = target.getElementById('photo-grid');
notEqual(photosAtFirst,photosNow);
for (var i = 0; i < 20; i ++){
equal(target.getElementById('pic'+i).children, 1);
}
done();
},1000);
},100);
for (var i = 0; i < 20; i ++){
ok(target.getElementById('pic'+i).children.length < 2);
}
done();
},8000);
});

test("input has a hover class", function(assert){
Expand Down

0 comments on commit a55c032

Please sign in to comment.