mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-05 15:36:22 +01:00
[js/ts] colorizer tests
This commit is contained in:
1 parent
e475fdebcc
commit
a5ae040dba
6 files changed
+12619
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
var gulp = require('gulp');
|
||||
var tsb = require('gulp-tsb');
|
||||
var util = require('./lib/util');
|
||||
var watcher = require('./lib/watch');
|
||||
var assign = require('object-assign');
|
||||
|
||||
var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions));
|
||||
|
||||
gulp.task('compile', function() {
|
||||
return gulp.src('**/*.ts', { base: '.' })
|
||||
.pipe(compilation())
|
||||
.pipe(gulp.dest(''));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
var src = gulp.src('**/*.ts', { base: '.' });
|
||||
|
||||
return watcher('**/*.ts', { base: '.' })
|
||||
.pipe(util.incremental(compilation, src))
|
||||
.pipe(gulp.dest(''));
|
||||
});
|
||||
|
||||
gulp.task('default', ['compile']);
|
||||
|
||||
function cloneArray(arr) {
|
||||
_.foo();
|
||||
var r = [];
|
||||
for (var i = 0, len = arr.length; i < len; i++) {
|
||||
r[i] = doClone(arr[i]);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
var ToggleText = React.createClass({
|
||||
getInitialState: function () {
|
||||
return {
|
||||
showDefault: true
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function (e) {
|
||||
// Prevent following the link.
|
||||
e.preventDefault();
|
||||
|
||||
// Invert the chosen default.
|
||||
// This will trigger an intelligent re-render of the component.
|
||||
this.setState({ showDefault: !this.state.showDefault })
|
||||
},
|
||||
|
||||
render: function () {
|
||||
// Default to the default message.
|
||||
var message = this.props.default;
|
||||
|
||||
// If toggled, show the alternate message.
|
||||
if (!this.state.showDefault) {
|
||||
message = this.props.alt;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Hello {message}!</h1>
|
||||
<a href="" onClick={this.toggle}>Toggle</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.render(<ToggleText default="World" alt="Mars" />, document.body);
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user