Visual Studio 2017似乎不支持ESlint静态intellisense,这使得.js文件中的编码变得非常痛苦,因为我必须运行CMD eslint命令来获取任何linting错误.在VSCode中,我可以使用ESLint扩展.Visual Studio 2017怎么样?
他们以任何方式启用它吗?
visual-studio eslint visual-studio-2015 visual-studio-2017 visual-studio-2019
使用酶,摩卡和期望断言.
我的单元测试的目的是检查在暂停时是否使用正确的参数调用调度,而不是在mergeProps中暂停.我需要动态地改变我的商店的状态:paused: true.
目前我尝试通过调度来更新暂停值,但我不认为这是正确的,因为它只是一个模拟而且实际上从未实际通过reducer运行.
我正在使用包redux-mock-store.
我该怎么做呢?
describe('Play Container', () => {
const id = 'audio-player-1';
const store = configureMockStore()({
players: {
'audio-player-1': { paused: false }
}
});
let dispatchSpy;
let wrapper;
beforeEach(() => {
dispatchSpy = expect.spyOn(store, 'dispatch');
wrapper = shallow(
<PlayContainer className={attributes.className}>
{children}
</PlayContainer>,
{ context: { id } },
).shallow({ context: { store } });
});
it('onClick toggles play if paused', () => {
//Not Working
store.dispatch(updateOption('paused', true, id));
wrapper.simulate('click');
expect(dispatchSpy).toHaveBeenCalledWith(play(id));
});
it('onClick …Run Code Online (Sandbox Code Playgroud) 我也在这里发布了一个问题:https : //github.com/mui-org/material-ui/issues/25312
所以,我使用的是 Material UI v5 的 Gatsby 示例:https : //github.com/mui-org/material-ui/tree/next/examples/gatsby
在他们提供的示例中,我添加了以下代码片段:
import { makeStyles } from '@material-ui/core';
const useStyles = makeStyles({
typographyHeader: {
fontWeight: 'bold',
fontSize: () => 30,
color: '#292929',
},
});
<Typography classes={{ root: classes.typographyHeader }} align="center">
Gatsby v5-alpha example
</Typography>
Run Code Online (Sandbox Code Playgroud)
这是在npm run develop启用 js 的情况下运行时的输出(浏览器模式):
这是在npm run develop禁用 js 的情况下运行时的输出(与 SSR 的输出相同):
您可以看到在第二个屏幕截图中,我的自定义样式已被材质 ui 的样式覆盖。使用 withStyles 时也会发生同样的问题。
谁能帮我找出正确的配置,以便我的样式不会被 Material UI v5 覆盖?
谢谢
错误:表达式树可能不包含对本地函数的引用
public void Initialize()
{
CloudStorageProperties ImageFileProperties(string fileName) => _cloudStorage.GetBlob(CloudStorageType.Image, fileName).FileProperties;
Config = new MapperConfiguration(x =>
{
x.CreateMap<Category, CategoryViewModel>()
.ForMember(vm => vm.ImagePath, m => m.MapFrom(src => ImageFileProperties(src.ImageFile.Name).Uri.AbsoluteUri));
});
}
Run Code Online (Sandbox Code Playgroud)
我可以用匿名函数替换本地函数,它可以工作但是更锐利地说我应该将它转换为本地函数.
为什么不允许这样做?
我使用Dropzone.js允许用户将文件上传到服务器,根据规格您可以更改缩略图宽度,如下所示,但是我想将宽度更改为100%而不是使用px,这可能吗?
因为如果我这样做
thumbnailWidth: 100%将无法识别%char.
dzImageOptions = Dropzone.options.myDropzone = {
thumbnailWidth: 314, //I want to change width to 100% instead
thumbnailHeight: 314,
init: function (file) {
}
}
//Also have to change css or thumbnail won't resize properly
.dropzone.song-image .dz-preview .dz-image {
border-radius: 1px;
width: 314px;
height: 314px;
}
<div class="dropzone song-image"></div>
Run Code Online (Sandbox Code Playgroud) 我有一个音量元素,当用户将鼠标悬停在音量栏上时会显示音量条.这一切都适用于桌面.但是,要在移动设备上获得相同的功能,用户可以点击volume元素,该元素也会切换静音点击事件.
当用户在移动设备上点击(即点按)该元素时,我想要停止该静音事件.
我不想修改Mute或VolumeBar类来修复它,因为这些是我的库中开发人员使用的泛型类.
https://jsfiddle.net/jwm6k66c/2145/
打开控制台 - >进入移动视图(Chrome上的CTRL + SHIFT + M) - >单击音量按钮并观察控制台日志.
我尝试过的:
使用volumeControlOnClick停止传播史时,音量条的高度为0(即不可见),这不,虽然取消的onClick.
我想要的是:
如果用户第一次在移动设备中单击音量图标,则取消静音点击事件.相反,它应该只显示音量条.
const volumeControlOnClick = (e) => {
const volumeBarContainer =
e.currentTarget.nextElementSibling.querySelector('.jp-volume-bar-container');
/* Stop propogation is for mobiles to stop
triggering mute when showing volume bar */
if (volumeBarContainer.clientHeight === 0) {
e.stopPropagation();
console.log("stop propogation")
}
};
class Volume extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return (
<div className="jp-volume-container">
<Mute onTouchStart={volumeControlOnClick}><i className="fa fa-volume-up" …Run Code Online (Sandbox Code Playgroud) 关于这个帖子的评论之一:检查条件并调用具有延迟统一周期的连续方法,说:
永远不要使用协同程序.他们从ac#开发者的角度来教导不良习惯,如果你做一个普通的c#工作会导致私刑
我的问题是,这是为什么?这只是在Unity还是一般?Unity的官方虚拟现实示例https://www.assetstore.unity3d.com/en/#!/content/51519非常重视它们(特别是传单示例)而不是Invoke或Invoke Repeating,这些示例项目最近也发布了.
我遇到的问题是,它&X-Requested-With=XMLHttpRequest&_=1462736803425一直附加到我的网址上,因为它是查询字符串的一部分。有没有一种方法可以阻止它成为查询字符串而Ajax.BeginForm无需执行“ hack”操作?
@using (Ajax.BeginForm("Search", "Filter", new { Area = "Music" }, new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "body-wrapper", OnSuccess = "updateHistory" }, new { @id = "search-form" }))
{
<div>
<i class="fa fa-search"></i>
<input type="search" placeholder="Search" id="search" name="searchString" />
</div>
}
public ActionResult Search(string searchString)
{
//do stuff
return PartialView();
}
Run Code Online (Sandbox Code Playgroud)
然后,在部分视图页面上,获取路径和查询:
@Html.HiddenFor(x => Request.Url.PathAndQuery)
Run Code Online (Sandbox Code Playgroud)
的值为Request.Url.PathAndQuery:http://localhost:1526/Music/Search?searchString=maid&X-Requested-With=XMLHttpRequest&_=1462736803425
然后使用History.js更新网址:
function pushState(target) {
manualStateChange = false;
History.pushState(null, null, $("#Request_Url_PathAndQuery").val());
}
Run Code Online (Sandbox Code Playgroud)
我有一个 asp.net 4 应用程序,它工作正常,但我无法让它在 asp.net core 上工作。文档说在或文件GetSetting中查找。存储模拟器已打开。web.configapp.config
public void ConfigureServices(IServiceCollection services)
{
AzureConfig.Initialize();
}
public static void Initialize()
{
//Always null
var connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString");
}
Run Code Online (Sandbox Code Playgroud)
根 web.config 文件:
<configuration>
<appSettings>
<add key="StorageConnectionString" value="UseDevelopmentStorage=true;" />
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我的 project.json 中有这些依赖项:
"Microsoft.WindowsAzure.ConfigurationManager": "3.2.1",
"WindowsAzure.Storage": "7.1.2",
"AzureSDK2.2DLLs": "1.0.0"
Run Code Online (Sandbox Code Playgroud)
编辑,这也不起作用:
{
"ConnectionStrings": {
"DefaultConnection": "..."
"StorageConnectionString": "UseDevelopmentStorage=true"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"StorageConnectionString": "UseDevelopmentStorage=true"
}
Run Code Online (Sandbox Code Playgroud) onSubmit处理程序中的值始终是一个空对象.如何将一些值传递给它以便我可以测试追加?
测试:
const store = createStore(combineReducers({ form: formReducer }));
const setup = (newProps) => {
const props = {
...newProps,
};
expect.spyOn(store, 'dispatch');
const wrapper = mount(
<Provider store={store}>
<RegisterFormContainer {...props} />
</Provider>,
);
return {
wrapper,
props,
};
};
describe('RegisterFormContainer.integration', () => {
let wrapper;
it('should append form data', () => {
({ wrapper } = setup());
const values = {
userName: 'TestUser',
password: 'TestPassword',
};
expect.spyOn(FormData.prototype, 'append');
// Passing values as second argument DOESN'T work, it's just an …Run Code Online (Sandbox Code Playgroud) javascript ×4
reactjs ×4
c# ×3
css ×3
jquery ×2
unit-testing ×2
ajax ×1
asp.net-core ×1
asp.net-mvc ×1
azure ×1
c#-7.0 ×1
coroutine ×1
dropzone.js ×1
enzyme ×1
eslint ×1
events ×1
html ×1
material-ui ×1
mocha.js ×1
redux ×1
redux-form ×1
resharper ×1