the monospace test works now

pull/1097/merge
Peter 'Pita' Martischka 2012-10-08 14:13:35 +02:00
parent a4d68b2b25
commit bd47b6c40b
2 changed files with 19 additions and 35 deletions

View File

@ -19,18 +19,17 @@
<script src="lib/jquery.iframe.js"></script>
<script src="specs/helper.js"></script>
<script src="specs/button_bold.js"></script>
<script src="specs/button_italic.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<script src="specs/keystroke_delete.js"></script>
<script src="specs/font_type.js"></script>
<!--
<script src="specs/button_indentation.js"></script>
<script src="specs/font_type.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<script src="specs/button_bold.js"></script>
<script src="specs/button_italic.js"></script>
<script src="specs/keystroke_delete.js"></script>
<script src="specs/embed_value.js"></script>-->
<script src="runner.js"></script>

View File

@ -1,45 +1,30 @@
describe("font select", function(){
//create a new pad before each test run
beforeEach(function(cb){
testHelper.newPad(cb);
helper.newPad(cb);
this.timeout(5000);
});
it("makes text monospace", function() {
//get the inner iframe
var $inner = testHelper.$getPadInner();
it("makes text monospace", function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
//open pad settings
var $settingsButton = testHelper.$getPadChrome().find(".buttonicon-settings");
//click on the settings button to make settings visible
var $settingsButton = chrome$(".buttonicon-settings");
$settingsButton.click();
//get the font selector and click it
var $viewfontmenu = testHelper.$getPadChrome().find("#viewfontmenu");
$viewfontmenu.click();
//get the font menu and monospace option
var $viewfontmenu = chrome$("#viewfontmenu");
var $monospaceoption = $viewfontmenu.find("[value=monospace]");
//get the monospace option and click it
var $monospaceoption = testHelper.$getPadChrome().find("[value=monospace]");
//select monospace and fire change event
$monospaceoption.attr('selected','selected');
$viewfontmenu.change();
/*
//check if font changed to monospace
var fontFamily = inner$("body").css("font-family").toLowerCase();
expect(fontFamily).to.be("monospace");
//get the font selector and click it
var $viewfontmenu = testHelper.$getPadChrome().find("#viewfontmenu");
$viewfontmenu.click(); // this doesnt work but I left it in for posterity.
$($viewfontmenu).attr('size',2); // this hack is required to make it visible ;\
//get the monospace option and click it
var $monospaceoption = testHelper.$getPadChrome().find("[value=monospace]");
$monospaceoption.attr('selected','selected'); // despite this being selected the event doesnt fire
$monospaceoption.click(); // this doesnt work but it should.
*/
// get the attributes of the body of the editor iframe
var bodyAttr = $inner.find("body");
var cssText = bodyAttr[0].style.cssText;
//make sure the text hasn't changed
expect(cssText).to.eql("font-family: monospace;");
done();
});
});