小编Fom*_*aut的帖子

如何用酶测试子成分方法?

我有一个这样的组件:

<Parent>
  <Child/>
</Parent>
Run Code Online (Sandbox Code Playgroud)

<Child/>组件有一个方法foo.我想测试foo方法,但我不知道如何访问它.我试过了:

mount(<Parent><Child/></Parent>).props().children.foo
Run Code Online (Sandbox Code Playgroud)

要么

mount(<Parent><Child/></Parent>).children().foo
Run Code Online (Sandbox Code Playgroud)

但他们都是undefined.我无法使用,.instance()因为它不是root.我无法挂载<Child/>只是因为<Parent>添加了一些东西(react-router's context.router),context而我在init时需要它们<Child/>.有这个想法吗?

javascript reactjs react-router enzyme

24
推荐指数
2
解决办法
1万
查看次数

科尔多瓦相机不会将图片旋转到三星S3上的正确方向

    var onSuccess = function(imageUri){
        $scope.report.imgUri = imageUri;
    };

    var onError = function(message){
        alert('Failed because: ' + message);
    };

    $scope.capturePhoto = function(){
        navigator.camera.getPicture(onSuccess, onError, {
            quality: 40,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            correctOrientation: true,
            saveToPhotoAlbum: true,
            encodingType: navigator.camera.EncodingType.PNG,
            targetWidth: divWidth
        });
    };
Run Code Online (Sandbox Code Playgroud)

嗨伙计们,我正在使用Android 4.3在Samsung S3上构建Cordova 3.5.0.该camera.capturePhoto功能始终忽略correctOrientation设置,因此pic不会旋转到正确的方向.但它适用于Android 4.4的HTC Butterfly.BTW,encodingType也不适用于Android.任何理想?

android cordova

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

Cordova PushPlugin onNotification ecb没有解雇

myApp.services.factory('GCMHelper', ($q)->

  pushNotification = {}

  _init = ()->
    defer = $q.defer()

    ionic.Platform.ready(()->
      pushNotification = window.plugins.pushNotification;
      window.onNotification = (res)->
        console.log('onNotification', res)
      defer.resolve()
    )

    return defer.promise

  return {
    register: ()->
      _init().then(()->
        pushNotification.register(
          (res)->
            console.log('gcm register success', res)
          (err)->
            console.log('gcm register err', err)
          {
            "senderID": "*********",
            "ecb": "onNotification"
          }
        );
      )
  }
)
Run Code Online (Sandbox Code Playgroud)

在控制器中:

GCMHelper.register()
Run Code Online (Sandbox Code Playgroud)

(请原谅我可怜的英语)我将Cordova PushPlugin与Cordova 4.2和Ionic beta 14联系起来,每次用"OK"字符串获得成功回调,但ecb onNotification从未被解雇,并且在控制台没有错误.我几乎没有理想......,任何一个帮助?

angularjs cordova google-cloud-messaging cordova-plugins ionic

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