Skip to content

Commit

Permalink
Add test case for ie10 iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
lifesinger committed Aug 27, 2013
1 parent c714a2a commit 165acdd
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lab/2013/ie10-iframe/a.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: red;
}
8 changes: 8 additions & 0 deletions lab/2013/ie10-iframe/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
define(function(require) {

require('./a.css')

var b = require('./b')
b.print()

})
8 changes: 8 additions & 0 deletions lab/2013/ie10-iframe/b.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
define({

print: function() {
document.body.innerHTML = 'OK'
}

})

15 changes: 15 additions & 0 deletions lab/2013/ie10-iframe/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<script src="https://a.alipayobjects.com/seajs/seajs/2.1.1/sea.js"></script>
<script>

seajs.use('./a')

</script>
</body>
</html>
42 changes: 42 additions & 0 deletions lab/2013/ie10-iframe/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var express = require('express')
var http = require('http')

var app = express()
var cfg = {
clientPort: 9998,
clientHost: getExternalIpAddress()
}

app.use(express.static(process.cwd()))


app.listen(cfg.clientPort, cfg.clientHost, function() {
console.info('Start client server<' + cfg.clientHost + ':' + cfg.clientPort + '>')

}).on('error', function(e) {
if (e.code === 'EADDRINUSE') {
consle.info('Port %d is in use, will auto find another one.', cfg.clientPort)
} else {
throw e
}
})

function getExternalIpAddress () {
var interfaces = require('os').networkInterfaces()
var addresses = []
Object.keys(interfaces).forEach(function(name) {
interfaces[name].forEach(function(node) {
if (node.family === 'IPv4' && node.internal === false) {
addresses.push(node)
}
})
})

if (addresses.length > 1) {
return addresses[1].address
}
if (addresses.length > 0) {
return addresses[0].address
}
}

15 changes: 15 additions & 0 deletions lab/2013/ie10-iframe/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<iframe src="iframe.html"></iframe>

<p>
<a href="https://github.com/totorojs/totoro/issues/93">https://github.com/totorojs/totoro/issues/93</a>
</p>

</body>
</html>

0 comments on commit 165acdd

Please sign in to comment.