-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62c8b62
commit 76af9bf
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | ||
<meta name="format-detection" content="telephone=no"/> | ||
<title>Internal Hybrid</title> | ||
|
||
<!--lib:css--> | ||
<!--endinject--> | ||
|
||
<!--application:css--> | ||
<!--endinject--> | ||
|
||
<!--lib:js--> | ||
<!--endinject--> | ||
|
||
<!--cordova:js--> | ||
<!--endinject--> | ||
|
||
<!--application:js--> | ||
<!--endinject--> | ||
|
||
<!--template:js--> | ||
<!--endinject--> | ||
</head> | ||
|
||
<body class="container"> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use strict"; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const should = require('should'); | ||
const sonar = require('../base/sonar.js'); | ||
const template = fs.readFileSync(path.join(__dirname, 'fixture', 'index-origin.html')).toString(); | ||
|
||
describe('sonar sub module', function () { | ||
it('should return html tag when template valid', function () { | ||
sonar.seekHtmlTag(template).trim().should.equal('<html lang="zh-CN">') | ||
}); | ||
|
||
it('should return false when template invalid', function () { | ||
sonar.seekHtmlTag('<p class="text-info"></p>').should.be.false; | ||
}); | ||
|
||
it('should return body tag when template valid', function () { | ||
sonar.seekBodyTag(template).trim().should.equal('<body class="container">') | ||
}); | ||
|
||
it('should return body tag when template invalid', function () { | ||
sonar.seekBodyTag('<p class="text-info"></p>').should.be.false; | ||
}); | ||
|
||
it('should return false when bodyTag have nothing class attribution', function () { | ||
sonar.seekClassAttr('<body id="world">').should.be.false; | ||
}); | ||
|
||
it('should return class name when bodyTag have class attribution', function () { | ||
sonar.seekClassAttr('<body class="text-info">').trim().should.equal('class="text-info"') | ||
}); | ||
|
||
it('should generate h5 class when zero argument', function () { | ||
sonar.seekCordovaClass().trim().should.equal('platform-h5'); | ||
}); | ||
|
||
it('should generate related cordova class', function () { | ||
sonar.seekCordovaClass('ios').trim().should.equal('platform-ios platform-cordova platform-webview'); | ||
sonar.seekCordovaClass('android').trim().should.equal('platform-android platform-cordova platform-webview'); | ||
}); | ||
}); |