mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
A self-test for testing stylus
This commit is contained in:
1
tools/tests/apps/app-using-stylus/.meteor/.gitignore
vendored
Normal file
1
tools/tests/apps/app-using-stylus/.meteor/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
local
|
||||
1
tools/tests/apps/app-using-stylus/.meteor/.id
Normal file
1
tools/tests/apps/app-using-stylus/.meteor/.id
Normal file
@@ -0,0 +1 @@
|
||||
1da9lx3m24vwv1kt1w0a
|
||||
8
tools/tests/apps/app-using-stylus/.meteor/packages
Normal file
8
tools/tests/apps/app-using-stylus/.meteor/packages
Normal file
@@ -0,0 +1,8 @@
|
||||
# Meteor packages used by this project, one per line.
|
||||
#
|
||||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||
# but you can also edit it by hand.
|
||||
|
||||
meteor-platform
|
||||
my-package
|
||||
stylus
|
||||
2
tools/tests/apps/app-using-stylus/.meteor/platforms
Normal file
2
tools/tests/apps/app-using-stylus/.meteor/platforms
Normal file
@@ -0,0 +1,2 @@
|
||||
browser
|
||||
server
|
||||
1
tools/tests/apps/app-using-stylus/.meteor/release
Normal file
1
tools/tests/apps/app-using-stylus/.meteor/release
Normal file
@@ -0,0 +1 @@
|
||||
none
|
||||
53
tools/tests/apps/app-using-stylus/.meteor/versions
Normal file
53
tools/tests/apps/app-using-stylus/.meteor/versions
Normal file
@@ -0,0 +1,53 @@
|
||||
autoupdate@1.2.2
|
||||
base64@1.0.3
|
||||
binary-heap@1.0.3
|
||||
blaze@2.1.2
|
||||
blaze-tools@1.0.3
|
||||
boilerplate-generator@1.0.3
|
||||
callback-hook@1.0.3
|
||||
check@1.0.5
|
||||
compiler-plugin@1.0.0
|
||||
ddp@1.2.0
|
||||
ddp-client@1.2.0
|
||||
ddp-common@1.2.0
|
||||
ddp-server@1.2.0
|
||||
deps@1.0.7
|
||||
ejson@1.0.6
|
||||
fastclick@1.0.6
|
||||
geojson-utils@1.0.3
|
||||
html-tools@1.0.4
|
||||
htmljs@1.0.4
|
||||
http@1.1.0
|
||||
id-map@1.0.3
|
||||
jquery@1.11.3_2
|
||||
json@1.0.3
|
||||
launch-screen@1.0.3
|
||||
livedata@1.0.13
|
||||
logging@1.0.8
|
||||
meteor@1.1.6
|
||||
meteor-platform@1.2.2
|
||||
minifiers@1.1.5
|
||||
minimongo@1.0.8
|
||||
mobile-status-bar@1.0.4
|
||||
mongo@1.1.0
|
||||
my-package@0.0.0
|
||||
npm-mongo@1.4.32_1
|
||||
observe-sequence@1.0.6
|
||||
ordered-dict@1.0.3
|
||||
random@1.0.3
|
||||
reactive-dict@1.1.0
|
||||
reactive-var@1.0.5
|
||||
reload@1.1.3
|
||||
retry@1.0.3
|
||||
routepolicy@1.0.5
|
||||
session@1.1.0
|
||||
spacebars@1.0.6
|
||||
spacebars-compiler@1.0.6
|
||||
stylus@2.0.0_511
|
||||
templating@1.1.1
|
||||
tracker@1.0.7
|
||||
ui@1.0.6
|
||||
underscore@1.0.3
|
||||
url@1.0.4
|
||||
webapp@1.2.1
|
||||
webapp-hashing@1.0.3
|
||||
8
tools/tests/apps/app-using-stylus/body.html
Normal file
8
tools/tests/apps/app-using-stylus/body.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<body>
|
||||
<div class="package-level">package-level</div>
|
||||
<div class="package-level-local-export">package-level-local-export</div>
|
||||
<div class="package-level-imported-to-app">package-level-imported-to-app</div>
|
||||
<div class="app-level">app-level</div>
|
||||
<div class="app-level-export">app-level-export</div>
|
||||
</body>
|
||||
|
||||
4
tools/tests/apps/app-using-stylus/client/app-export.styl
Normal file
4
tools/tests/apps/app-using-stylus/client/app-export.styl
Normal file
@@ -0,0 +1,4 @@
|
||||
.app-level-export {
|
||||
background-color: aqua
|
||||
}
|
||||
|
||||
7
tools/tests/apps/app-using-stylus/client/app.main.styl
Normal file
7
tools/tests/apps/app-using-stylus/client/app.main.styl
Normal file
@@ -0,0 +1,7 @@
|
||||
@import '{my-package}/package-export.styl'
|
||||
@import '{}/client/app-export.styl'
|
||||
|
||||
.app-level {
|
||||
background-color: chocolate
|
||||
}
|
||||
|
||||
26
tools/tests/apps/app-using-stylus/main.js
Normal file
26
tools/tests/apps/app-using-stylus/main.js
Normal file
@@ -0,0 +1,26 @@
|
||||
if (Meteor.isClient) {
|
||||
Meteor.startup(function () {
|
||||
var classes = ['app-level', 'app-level-export', 'package-level', 'package-level-local-export', 'package-level-imported-to-app'];
|
||||
var colors = ['chocolate', 'cyan', 'salmon', 'red', 'blue'];
|
||||
for (var i in classes) {
|
||||
var selector = '.' + classes[i];
|
||||
Meteor.call('print', getComputedStyle(document.querySelector(selector))['background-color'] === colorToRGBString(colors[i]));
|
||||
}
|
||||
});
|
||||
|
||||
function colorToRGBString(color) {
|
||||
d = document.createElement("div");
|
||||
d.style.color = color;
|
||||
document.body.appendChild(d);
|
||||
var str = getComputedStyle(d).color;
|
||||
document.body.removeChild(d);
|
||||
return str;
|
||||
}
|
||||
} else {
|
||||
Meteor.methods({
|
||||
print: function (str) {
|
||||
console.log(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.package-level-imported-to-app {
|
||||
background-color: blue
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.package-level {
|
||||
background-color: salmon
|
||||
}
|
||||
|
||||
@import 'package-local-export.styl'
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
.package-level-local-export {
|
||||
background-color: red
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Package.describe({
|
||||
summary: "test local package for using stylus"
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
api.addFiles('package-file.main.styl', 'client');
|
||||
api.addFiles('package-local-export.styl', 'client');
|
||||
api.addFiles('package-export.styl', 'client');
|
||||
|
||||
api.use('stylus');
|
||||
});
|
||||
30
tools/tests/stylus-cross-packages.js
Normal file
30
tools/tests/stylus-cross-packages.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var selftest = require('../selftest.js');
|
||||
var Sandbox = selftest.Sandbox;
|
||||
var utils = require('../utils.js');
|
||||
|
||||
selftest.define("can import stylus across packages", function (options) {
|
||||
var s = new Sandbox({
|
||||
clients: options.clients
|
||||
});
|
||||
|
||||
s.createApp("myapp", "app-using-stylus");
|
||||
s.cd("myapp");
|
||||
s.testWithAllClients(function (run) {
|
||||
run.match("myapp");
|
||||
run.match("proxy");
|
||||
run.match("MongoDB");
|
||||
run.match("running at");
|
||||
run.match("localhost");
|
||||
|
||||
run.connectClient();
|
||||
run.waitSecs(40);
|
||||
|
||||
run.match("true");
|
||||
run.match("true");
|
||||
run.match("true");
|
||||
run.match("true");
|
||||
run.match("true");
|
||||
|
||||
run.stop();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user