##// END OF EJS Templates
Apply width and height to outter most div of the tab widget.
Apply width and height to outter most div of the tab widget.

File last commit:

r19739:7c74a0d3
r21464:39954bd8
Show More
widget_image.js
49 lines | 2.5 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test image class
casper.notebook_test(function () {
Matthias Bussonnier
Some code cleanup in javascript and python...
r19739 "use strict";
var index = this.append_cell(
Jonathan Frederic
Organized tests.
r14464 'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);
// Get the temporary directory that the test server is running in.
var cwd = '';
index = this.append_cell('!echo $(pwd)');
this.execute_cell_then(index, function(index){
cwd = this.get_output_cell(index).text.trim();
});
Jonathan Frederic
Don't screenshot in the ImageWidget test,...
r17393 var test_jpg = '/9j/4AAQSkZJRgABAQEASABIAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDACAWGBwYFCAcGhwkIiAmMFA0MCwsMGJGSjpQdGZ6eHJmcG6AkLicgIiuim5woNqirr7EztDOfJri8uDI8LjKzsb/2wBDASIkJDAqMF40NF7GhHCExsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsb/wgARCAABAAEDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAAA//EABUBAQEAAAAAAAAAAAAAAAAAAAME/9oADAMBAAIQAxAAAAECv//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAQUCf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Bf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Bf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEABj8Cf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8hf//aAAwDAQACAAMAAAAQn//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Qf//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Qf//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAT8Qf//Z';
Jonathan Frederic
Organized tests.
r14464
var image_index = this.append_cell(
'import base64\n' +
'data = base64.b64decode("' + test_jpg + '")\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'image = widgets.Image()\n' +
Jonathan Frederic
Fixed *almost* all of the test-detected bugs
r14596 'image.format = "jpeg"\n' +
Jonathan Frederic
Organized tests.
r14464 'image.value = data\n' +
'image.width = "50px"\n' +
'image.height = "50px"\n' +
'display(image)\n' +
'print("Success")\n');
this.execute_cell_then(image_index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Organized tests.
r14464 'Create image executed with correct output.');
Jonathan Frederic
Make all tests async display safe
r18910 });
// Wait for the widget to actually display.
var img_selector = '.widget-area .widget-subarea img';
this.wait_for_element(image_index, img_selector);
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Make all tests async display safe
r18910 this.then(function(){
this.test.assert(this.cell_element_exists(image_index,
Jonathan Frederic
Organized tests.
r14464 '.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_exists(image_index, img_selector), 'Image exists.');
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Don't screenshot in the ImageWidget test,...
r17393 // Verify that the image's base64 data has made it into the DOM.
Jonathan Frederic
Make all tests async display safe
r18910 var img_src = this.cell_element_function(image_index, img_selector, 'attr', ['src']);
Jonathan Frederic
Don't screenshot in the ImageWidget test,...
r17393 this.test.assert(img_src.indexOf(test_jpg) > -1, 'Image src data exists.');
Jonathan Frederic
Organized tests.
r14464 });
Matthias Bussonnier
Some code cleanup in javascript and python...
r19739 });