小编jay*_*jay的帖子

使用mocha和超级测试进行NodeJS HTTPS API测试 - "DEPTH_ZERO_SELF_SIGNED_CERT"

我需要测试通过提供一个API HTTPSmochasuper test (证书都没有过期)

这是服务器的要点:

...
var app = express();
var _options = {
    key: fs.readFileSync('my-key.pem');,
    cert: fs.readFileSync('my-cert.pem')
};

// Start HTTPS server
https.createServer(_options, app).listen(app.get('port'), app.get('ip'), function () {

 // ok or not logs

});
Run Code Online (Sandbox Code Playgroud)

这是要测试的路线

app.get('/hello',function (req, res) {
   res.json(200);
});
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用此代码进行测试 test/test.js

    var supertest = require('supertest'),
        api = supertest('https://localhost:3000');

describe('Hello test', function () {

      it('hello', function (done) {

        api.get('/hello')
               .expect(200)
               .end(function (err, res) {
                                        if (err) {
                                                   done(err);
                                        } else {
                                                   done();
               }
         }); …
Run Code Online (Sandbox Code Playgroud)

javascript https mocha.js node.js supertest

12
推荐指数
1
解决办法
3534
查看次数

Angular ng-disabled with function

我想使用具有从函数返回的动态值的disabled-ng.

我尝试了几种方法,但它没有用.

<textarea id="{{exercise.type}}" ng-disabled={{prova}}></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova()></textarea>
Run Code Online (Sandbox Code Playgroud)

有了这个javascript函数

$scope.prova=function(e){               
               return true;
       };
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-ui angularjs-scope

11
推荐指数
1
解决办法
5万
查看次数

Titanium facebook模块单线程

我使用Titanium(3.1.3)和Alloy实现了facebook登录.

但有时当我尝试登录时,我发送此消息错误.

message = "FBSession: should only be used from a single thread";

facebook titanium titanium-modules titanium-alloy

5
推荐指数
1
解决办法
452
查看次数

用猫鼬推入子阵列

我有一个具有三个深度级别的数据模型。

var job = mongoose.Schema({
        id:Number,
        jobName:String    
    });

var demo = mongoose.Schema({

            id:Number,
            demoName:String,
            job:[job]
    });

var ExerciseSchema = mongoose.Schema({

            id:Number,
            name:String,
            area:String,
            medicalObj:[demo]   
    });
Run Code Online (Sandbox Code Playgroud)

var Exercise = mongoose.model('Exercise', ExerciseSchema);

我想在第二个嵌套数组中推送新对象

我正在尝试这种方式,但不起作用:

    Exercise.update({'area':area},{$push:{"medicalObj.job":{jobName:'Andrea'}}},{upsert:true},function(err){

        if(err){
                console.log("ERROR" + err);
        }else{
                console.log("Successfully");

        }
  });
Run Code Online (Sandbox Code Playgroud)

javascript json mongoose mongodb node.js

5
推荐指数
1
解决办法
1623
查看次数

从OpenShift Mongodb保存文档

我有一个scalable appOpenShiftMongoDb2.2广告NodeJs0.10,

由于我无法使用,Cartridge rockmongo-1.1因为它无法嵌入可扩展的应用程序,

我怎样才能让我的db'documents,做一个BackupRestoressh

javascript mongodb node.js openshift

5
推荐指数
1
解决办法
443
查看次数

钛合金SplitWindow IOS奇怪的行为改变宽度

  <SplitWindow id="home" platform="ios" formFactor="tablet">
            <Require src="master" id="master"/>
            <Require src="detail" id="detail"/>
  </SplitWindow>
Run Code Online (Sandbox Code Playgroud)

strange behavior如果我black separation line在两个窗口之间水平拖动,我有一个.窗户改变大小适应我​​的动作.

在此输入图像描述 在此输入图像描述 在此输入图像描述

而且,如果我更改width窗户更容易识别black separation line

function demo() {
Alloy.Globals.master.win.width = 512;
Alloy.Globals.detail.win.width = 512;
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 在此输入图像描述

[For test purpose you have to aim the exact pixel of the black separation line ]

你能说出为什么会发生这种情况,我该如何阻止这种行为?

javascript titanium titanium-mobile ios7 titanium-alloy

5
推荐指数
1
解决办法
235
查看次数

使用正则表达式验证昵称

我需要验证没有@和的昵称,#并且不能以数字开头

这是我的解决方案,但@#

(^[^0-9])([\w a-z A-Z 0-9][^@#])
Run Code Online (Sandbox Code Playgroud)

。测试:

andrea //true
0andrea // false

// these are true but I need them to be false

and@rea // true
and#rea // true
Run Code Online (Sandbox Code Playgroud)

javascript regex

4
推荐指数
1
解决办法
3972
查看次数

使用单个Controller控制两个Partial时,不加载Angular css文件

我正在开发一个基于MEAN堆栈的Web应用程序.我使用bootstrap作为css lib,并在我的"app.css"和"mio.css"的两个文件中有一些css覆盖,应用程序工作正常,直到我点击refresh处理两个部分的控制器,而不是一切都重新加载除了我的2个css文件.

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.min.css" rel="stylesheet">

 <link rel="stylesheet" href="css/app.css">
 <link rel="stylesheet" href="css/mio.css">
Run Code Online (Sandbox Code Playgroud)

如果我检查它们,它们包含index.html数据(头部主体dcc)

你能建议发生什么事吗?

css node.js express twitter-bootstrap angularjs

3
推荐指数
1
解决办法
1796
查看次数