##// END OF EJS Templates
don't store signatures in notebooks...
don't store signatures in notebooks store them in an sqlite database instead. The algorithm and signature are stored and not associated with a path. This means that moving files around doesn't affect trust, and every trusted change to a notebook remains trusted.

File last commit:

r19480:67f48566
r19625:0dbcfac8
Show More
markdown.js
62 lines | 2.2 KiB | application/javascript | JavascriptLexer
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 //
// Test that a Markdown cell is rendered to HTML.
//
Paul Ivanov
pep8 style function names
r13275 casper.notebook_test(function () {
David Wyde
Add tests for Markdown toolbar and menubar entries.
r13254 // Test JavaScript models.
var output = this.evaluate(function () {
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 IPython.notebook.to_markdown();
var cell = IPython.notebook.get_selected_cell();
cell.set_text('# Foo');
cell.render();
return cell.get_rendered();
});
MinRK
remove heading cells in v4
r18596 this.test.assertEquals(output.trim(), '<h1 id=\"Foo\">Foo<a class=\"anchor-link\" href=\"#Foo\">ΒΆ</a></h1>', 'Markdown JS API works.');
David Wyde
Add tests for Markdown toolbar and menubar entries.
r13254
// Test menubar entries.
output = this.evaluate(function () {
$('#to_code').mouseenter().click();
$('#to_markdown').mouseenter().click();
var cell = IPython.notebook.get_selected_cell();
MinRK
remove heading cells in v4
r18596 cell.set_text('**Bar**');
David Wyde
Add tests for Markdown toolbar and menubar entries.
r13254 $('#run_cell').mouseenter().click();
return cell.get_rendered();
});
MinRK
remove heading cells in v4
r18596 this.test.assertEquals(output.trim(), '<p><strong>Bar</strong></p>', 'Markdown menubar items work.');
David Wyde
Add tests for Markdown toolbar and menubar entries.
r13254
// Test toolbar buttons.
output = this.evaluate(function () {
$('#cell_type').val('code').change();
$('#cell_type').val('markdown').change();
var cell = IPython.notebook.get_selected_cell();
MinRK
remove heading cells in v4
r18596 cell.set_text('*Baz*');
Bussonnier Matthias
saving notebook does not run cell....
r19480 $("button[data-jupyter-action='ipython.run-select-next']")[0].click();
David Wyde
Add tests for Markdown toolbar and menubar entries.
r13254 return cell.get_rendered();
});
MinRK
remove heading cells in v4
r18596 this.test.assertEquals(output.trim(), '<p><em>Baz</em></p>', 'Markdown toolbar items work.');
Paul Ivanov
test: changing text of cell resets rendered status
r17346
MinRK
remove heading cells in v4
r18596 // Test markdown headings
Paul Ivanov
test: changing text of cell resets rendered status
r17346
MinRK
remove heading cells in v4
r18596 var text = 'multi\nline';
this.evaluate(function (text) {
Paul Ivanov
test: changing text of cell resets rendered status
r17346 var cell = IPython.notebook.insert_cell_at_index('markdown', 0);
MinRK
remove heading cells in v4
r18596 cell.set_text(text);
}, {text: text});
var set_level = function (level) {
return casper.evaluate(function (level) {
var cell = IPython.notebook.get_cell(0);
cell.set_heading_level(level);
return cell.get_text();
}, {level: level});
};
Paul Ivanov
test: changing text of cell resets rendered status
r17346
MinRK
remove heading cells in v4
r18596 var level_text;
var levels = [ 1, 2, 3, 4, 5, 6, 2, 1 ];
for (var idx=0; idx < levels.length; idx++) {
var level = levels[idx];
level_text = set_level(level);
hashes = new Array(level + 1).join('#');
this.test.assertEquals(level_text, hashes + ' ' + text, 'markdown set_heading_level ' + level);
}
David Wyde
Add CasperJS utility functions, and tests for code and...
r13249 });