我有
const saveBtnElement = fixture.debugElement.nativeElement.querySelector('#save-user');
console.log(saveBtnElement);
在console
的业力测试中可以看到的地方:
<my-button _ngcontent-c0="" id="save-user" _nghost-c3="" ng-reflect-disabled="true" ng-reflect-classnames="primary">
<button _ngcontent-c3="" class="my-button primary" ng-reflect-ng-class="my-button primary" disabled="">
<!--bindings={
"ng-reflect-ng-if": ""
}-->
<!--bindings={
"ng-reflect-ng-if": "false"
}-->
<!--bindings={
"ng-reflect-ng-if": "true"
}-->
<span _ngcontent-c3="">
Save & Close
</span>
我想使用类似的方法来检查按钮的禁用属性
expect(saveBtnElement.hasAttribute('disabled')).toBeTruthy();
如何获取位于我的另一个组件<button>
中的my-button
?
答案 0 :(得分:1)
由Bunyamin提供:
<?php
$filename = 'pr.jpg';
$api_url = 'https://content.dropboxapi.com/2/files/upload'; //dropbox api url
$token = 'Generated access token'; // oauth token
$headers = array('Authorization: Bearer '. $token,
'Content-Type: application/octet-stream',
'Dropbox-API-Arg: '.
json_encode(
array(
"path"=> '/'. basename($filename),
"mode" => "add",
"autorename" => true,
"mute" => false
)
)
);
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
$path = $filename;
$fp = fopen($path, 'rb');
$filesize = filesize($path);
curl_setopt($ch, CURLOPT_POSTFIELDS, fread($fp, $filesize));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1); // debug
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo($response.'<br/>');
echo($http_code.'<br/>');
curl_close($ch);
成功了!