Adopt dev-setup in smoketest

This commit is contained in:
Alex Dima 2016-08-27 12:04:24 +02:00
parent 8a50a4ffc0
commit 8a31f7f50e
4 changed files with 15 additions and 79 deletions

View file

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="./index.css" />
</head>
<body>
<h2>Monaco Editor (running from release)</h2>
<div id="bar" style="margin-bottom: 6px;"></div>
<div style="clear:both"></div>
<div id="container" style="float:left;width:800px;height:450px;border: 1px solid grey"></div>
<div id="options" style="float:left;width:220px;height:450px;border: 1px solid grey"></div>
<div style="clear:both"></div>
<script src="../release/min/vs/loader.js"></script>
<script>
require.config({
paths: {
'vs': '../release/min/vs'
}
});
require(['vs/editor/editor.main'], function() {
require(['./index'], function() {});
});
</script>
</body>
</html>

View file

@ -9,11 +9,8 @@
<h2>Monaco Editor (running from multiple sources)</h2>
<a href="./index.html">[MULTIPLE SOURCES]</a>
&nbsp;|&nbsp;
<a href="./index-release.html">[RELEASED]</a>
&nbsp;|&nbsp;
<a href="./smoketest-release.html">[SMOKETEST]</a>
Jump to:
<a href="./smoketest.html?editor=releaseMin">[SMOKETEST]</a>
&nbsp;|&nbsp;
<a href="./mouse-fixed.html">[fixed element]</a>
&nbsp;|&nbsp;

View file

@ -23,21 +23,17 @@
</head>
<body>
<h2>Smoke Test (running from release)</h2>
<h2>Smoke Test</h2>
<div id="control"></div>
<div id="editor"></div>
<div id="errors"></div>
<div style="clear:both"></div>
<script src="../release/min/vs/loader.js"></script>
<script src="../metadata.js"></script>
<script src="dev-setup.js"></script>
<script>
require.config({
paths: {
'vs': '../release/min/vs'
}
});
require(['vs/editor/editor.main'], function() {
loadEditor(function() {
require(['./smoketest'], function() {});
});
</script>

View file

@ -1,5 +1,10 @@
/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />
define([], function() {
define(['./samples-all'], function(ALL_SAMPLES) {
var XHR_SAMPLES = {};
ALL_SAMPLES.forEach(function(sample) {
XHR_SAMPLES[sample.name] = sample.content;
});
var actions = (function() {
"use strict";
@ -88,11 +93,9 @@ function createEditor(container, mode) {
editors[mode] = monaco.editor.create(container, {
value: mode
});
xhr('samples/sample.' + mode + '.txt').then(function(response) {
var value = mode + '\n' + response.responseText;
var value = mode + '\n' + XHR_SAMPLES['sample.' + mode + '.txt'];
var model = monaco.editor.createModel(value, mode);
editors[mode].setModel(model);
});
}
function createEditors(modes) {
@ -133,33 +136,4 @@ function createActions(actions) {
createEditors(getAllModes());
createActions(actions);
function xhr(url) {
var req = null;
return new monaco.Promise(function(c,e,p) {
req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req._canceled) { return; }
if (req.readyState === 4) {
if ((req.status >= 200 && req.status < 300) || req.status === 1223) {
c(req);
} else {
e(req);
}
req.onreadystatechange = function () { };
} else {
p(req);
}
};
req.open("GET", url, true );
req.responseType = "";
req.send(null);
}, function () {
req._canceled = true;
req.abort();
});
}
});