mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-24 20:14:37 -04:00
Clean code.
This commit is contained in:
parent
41b199c578
commit
c732fbb363
2 changed files with 4 additions and 9 deletions
|
@ -23,19 +23,11 @@ describe('module \'' + ID + '\'', function () {
|
||||||
|
|
||||||
return this.definition.fn(_, this.xEvent, this.xSettings);
|
return this.definition.fn(_, this.xEvent, this.xSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.titleBak = document.title;
|
|
||||||
this.dummyTitle = util.uniqId();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function () {
|
after(function () {
|
||||||
|
|
||||||
document.title = this.titleBak;
|
util.restoreHtml();
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
|
|
||||||
document.title = this.dummyTitle;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('definition', function () {
|
describe('definition', function () {
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var title;
|
||||||
var htmlClasses;
|
var htmlClasses;
|
||||||
var $pinnedElements;
|
var $pinnedElements;
|
||||||
|
|
||||||
function pinHtml() {
|
function pinHtml() {
|
||||||
|
|
||||||
|
title = document.title;
|
||||||
htmlClasses = $('html').attr('class');
|
htmlClasses = $('html').attr('class');
|
||||||
$pinnedElements = $('head,body').children();
|
$pinnedElements = $('head,body').children();
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreHtml() {
|
function restoreHtml() {
|
||||||
|
|
||||||
|
document.title = title;
|
||||||
$('html').attr('class', htmlClasses);
|
$('html').attr('class', htmlClasses);
|
||||||
$('head,body').children().not($pinnedElements).remove();
|
$('head,body').children().not($pinnedElements).remove();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue