Add `[Remote(routeName : "name")]` tests
- relates to #4445
- also relates to #4309 / fb07fee though restored and renamed files are slightly different
- latest Unobtrusive version; copy just one file under `wwwroot`
- add JavaScript file and CDN links to enable manual testing of `[Remote]` tests in `BasicWebSite`
- include renamed files for recreating the minimized JavaScript file manually
This commit is contained in:
parent
742a9e3f3b
commit
e3db547011
|
|
@ -12,7 +12,6 @@ PublishProfiles/
|
|||
.vs/
|
||||
bower_components/
|
||||
node_modules/
|
||||
**/wwwroot/lib/
|
||||
debugSettings.json
|
||||
project.lock.json
|
||||
*.user
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("", "\"/RemoteAttribute_Verify/IsIdAvailable rejects Joe1.\"")]
|
||||
[InlineData("", "\"/RemoteAttribute_Verify/IsIdAvailable rejects UserId1: 'Joe1'.\"")]
|
||||
[InlineData("/Area1", "false")]
|
||||
[InlineData("/Area2",
|
||||
"\"/Area2/RemoteAttribute_Verify/IsIdAvailable rejects 'Joe4' with 'Joe1', 'Joe2', and 'Joe3'.\"")]
|
||||
|
|
@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("", "\"/RemoteAttribute_Verify/IsIdAvailable rejects Jane1.\"")]
|
||||
[InlineData("", "\"/RemoteAttribute_Verify/IsIdAvailable rejects UserId1: 'Jane1'.\"")]
|
||||
[InlineData("/Area1", "false")]
|
||||
public async Task RemoteAttribute_VerificationAction_PostReturnsExpectedJson(
|
||||
string pathSegment,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId1">UserId1</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId1' is invalid." data-val-remote-additionalfields="*.UserId1" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" id="UserId1" name="UserId1" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId1' is invalid." data-val-remote-additionalfields="*.UserId1" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId1 is required" id="UserId1" name="UserId1" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId1" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId2">UserId2</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId2' is invalid." data-val-remote-additionalfields="*.UserId2" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" id="UserId2" name="UserId2" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId2' is invalid." data-val-remote-additionalfields="*.UserId2" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId2 is required" id="UserId2" name="UserId2" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId2" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId3">UserId3</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="/Area1/RemoteAttribute_Verify/IsIdAvailable rejects you." data-val-remote-additionalfields="*.UserId3" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" id="UserId3" name="UserId3" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="/Area1/RemoteAttribute_Verify/IsIdAvailable rejects you." data-val-remote-additionalfields="*.UserId3" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId3 is required" id="UserId3" name="UserId3" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId3" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -64,11 +64,19 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId4">UserId4</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId4' is invalid." data-val-remote-additionalfields="*.UserId4,*.UserId1,*.UserId2,*.UserId3" data-val-remote-url="/Area2/RemoteAttribute_Verify/IsIdAvailable" id="UserId4" name="UserId4" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId4' is invalid." data-val-remote-additionalfields="*.UserId4,*.UserId1,*.UserId2,*.UserId3" data-val-remote-url="/Area2/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId4 is required" id="UserId4" name="UserId4" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId4" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId5">UserId5</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId5' is invalid." data-val-remote-additionalfields="*.UserId5" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId5 is required" id="UserId5" name="UserId5" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId5" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
|
|
@ -83,10 +91,10 @@
|
|||
|
||||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
||||
|
||||
<script src="/lib/jquery-validation/jquery.validate.js"></script>
|
||||
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
|
||||
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId1">UserId1</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId1' is invalid." data-val-remote-additionalfields="*.UserId1" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" id="UserId1" name="UserId1" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId1' is invalid." data-val-remote-additionalfields="*.UserId1" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId1 is required" id="UserId1" name="UserId1" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId1" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId2">UserId2</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId2' is invalid." data-val-remote-additionalfields="*.UserId2" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" id="UserId2" name="UserId2" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId2' is invalid." data-val-remote-additionalfields="*.UserId2" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId2 is required" id="UserId2" name="UserId2" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId2" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId3">UserId3</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="/Area1/RemoteAttribute_Verify/IsIdAvailable rejects you." data-val-remote-additionalfields="*.UserId3" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" id="UserId3" name="UserId3" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="/Area1/RemoteAttribute_Verify/IsIdAvailable rejects you." data-val-remote-additionalfields="*.UserId3" data-val-remote-url="/Area1/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId3 is required" id="UserId3" name="UserId3" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId3" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -64,11 +64,19 @@
|
|||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId4">UserId4</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId4' is invalid." data-val-remote-additionalfields="*.UserId4,*.UserId1,*.UserId2,*.UserId3" data-val-remote-url="/Area2/RemoteAttribute_Verify/IsIdAvailable" id="UserId4" name="UserId4" type="text" value="" />
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId4' is invalid." data-val-remote-additionalfields="*.UserId4,*.UserId1,*.UserId2,*.UserId3" data-val-remote-url="/Area2/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId4 is required" id="UserId4" name="UserId4" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId4" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="UserId5">UserId5</label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control text-box single-line" data-val="true" data-val-remote="'UserId5' is invalid." data-val-remote-additionalfields="*.UserId5" data-val-remote-type="Post" data-val-remote-url="/RemoteAttribute_Verify/IsIdAvailable" data-val-required="UserId5 is required" id="UserId5" name="UserId5" type="text" value="" />
|
||||
<span class="field-validation-valid text-danger" data-valmsg-for="UserId5" data-valmsg-replace="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
|
|
@ -83,10 +91,10 @@
|
|||
|
||||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
||||
|
||||
<script src="/lib/jquery-validation/jquery.validate.js"></script>
|
||||
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
|
||||
<script src="/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -55,6 +55,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.UserId5, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.UserId5, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.UserId5, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
|
|
@ -68,8 +76,6 @@
|
|||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@* Until script helpers are available, add script references manually. *@
|
||||
@* @Scripts.Render("~/bundles/jqueryval") *@
|
||||
<script src="@Url.Content("~/lib/jquery-validation/jquery.validate.js")"></script>
|
||||
<script src="@Url.Content("~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js")"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
}
|
||||
|
|
@ -61,6 +61,16 @@
|
|||
@Html.DisplayFor(model => model.UserId4)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.UserId5)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.UserId5)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
@RenderBody()
|
||||
</div>
|
||||
|
||||
<script src="~/lib/jquery/jquery.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -20,7 +20,6 @@ namespace BasicWebSite.Controllers
|
|||
[HttpPost]
|
||||
public IActionResult Create(RemoteAttributeUser user)
|
||||
{
|
||||
ModelState.Remove("id");
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(user);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,44 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using BasicWebSite.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BasicWebSite.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
public class RemoteAttribute_VerifyController : Controller
|
||||
{
|
||||
// This action is overloaded and may receive requests to validate either UserId1 or UserId2.
|
||||
// This action is overloaded and may receive requests to validate UserId1, UserId2 or UserId5.
|
||||
[AcceptVerbs("Get", "Post")]
|
||||
public IActionResult IsIdAvailable(string userId1, string userId2)
|
||||
[Route("[controller]/[action]", Name = "VerifyRoute")]
|
||||
public IActionResult IsIdAvailable(string userId1, string userId2, string userId5)
|
||||
{
|
||||
return Json(data: string.Format("/RemoteAttribute_Verify/IsIdAvailable rejects {0}.", userId1 ?? userId2));
|
||||
string name;
|
||||
string value;
|
||||
if (userId1 != null)
|
||||
{
|
||||
name = nameof(RemoteAttributeUser.UserId1);
|
||||
value = userId1;
|
||||
}
|
||||
else if (userId2 != null)
|
||||
{
|
||||
|
||||
name = nameof(RemoteAttributeUser.UserId2);
|
||||
value = userId2;
|
||||
}
|
||||
else if (userId5 != null)
|
||||
{
|
||||
|
||||
name = nameof(RemoteAttributeUser.UserId5);
|
||||
value = userId5;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "unknown";
|
||||
value = string.Empty;
|
||||
}
|
||||
|
||||
return Json(data: $"/RemoteAttribute_Verify/IsIdAvailable rejects {name}: '{value}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BasicWebSite.Models
|
||||
|
|
@ -10,25 +11,33 @@ namespace BasicWebSite.Models
|
|||
public int Id { get; set; }
|
||||
|
||||
// Controller in current area.
|
||||
[Required(ErrorMessage = "UserId1 is required")]
|
||||
[Remote(action: "IsIdAvailable", controller: "RemoteAttribute_Verify")]
|
||||
public string UserId1 { get; set; }
|
||||
|
||||
// Controller in root area.
|
||||
[Required(ErrorMessage = "UserId2 is required")]
|
||||
[Remote(action: "IsIdAvailable", controller: "RemoteAttribute_Verify", areaName: null, HttpMethod = "Post")]
|
||||
public string UserId2 { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "UserId3 is required")]
|
||||
[Remote(
|
||||
action: "IsIdAvailable",
|
||||
controller: "RemoteAttribute_Verify",
|
||||
areaName:"Area1",
|
||||
areaName: "Area1",
|
||||
ErrorMessage = "/Area1/RemoteAttribute_Verify/IsIdAvailable rejects you.")]
|
||||
public string UserId3 { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "UserId4 is required")]
|
||||
[Remote(
|
||||
action:"IsIdAvailable",
|
||||
controller: "RemoteAttribute_Verify",
|
||||
areaName: "Area2",
|
||||
AdditionalFields = "UserId1, UserId2, UserId3")]
|
||||
public string UserId4 { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "UserId5 is required")]
|
||||
[Remote(routeName: "VerifyRoute", HttpMethod = "Post")]
|
||||
public string UserId5 { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.UserId5, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.UserId5, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.UserId5, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
|
|
@ -68,8 +76,6 @@
|
|||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@* Until script helpers are available, add script references manually. *@
|
||||
@* @Scripts.Render("~/bundles/jqueryval") *@
|
||||
<script src="@Url.Content("~/lib/jquery-validation/jquery.validate.js")"></script>
|
||||
<script src="@Url.Content("~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js")"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
}
|
||||
|
|
@ -61,6 +61,16 @@
|
|||
@Html.DisplayFor(model => model.UserId4)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.UserId5)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.UserId5)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
@RenderBody()
|
||||
</div>
|
||||
|
||||
<script src="~/lib/jquery/jquery.js"></script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "BasicWebSite",
|
||||
"description": "Web site demonstrating various validations.",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jquery-validation-unobtrusive": "3.2.6"
|
||||
},
|
||||
"exportsOverride": {
|
||||
"jquery-validation-unobtrusive": {
|
||||
"": "jquery.validate.unobtrusive.min.js"
|
||||
},
|
||||
"*": { }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
To recreate minified JavaScript file,
|
||||
|
||||
1. Update jquery-validation-unobtrusive version in _bower.json if necessary.
|
||||
2. Rename or copy _bower.json to bower.json, _gruntfile.js to gruntfile.js, and _package.json to package.json.
|
||||
3. Run build from the repo root. (Minimum command is `./build.sh --quiet run-grunt`.)
|
||||
4. Remove bower.json, gruntfile.js and package.json.
|
||||
5. Check in _bower.json and new jquery.validate.unobtrusive.min.js file.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
bower: {
|
||||
install: {
|
||||
options: {
|
||||
targetDir: "wwwroot/lib",
|
||||
layout: "byComponent",
|
||||
cleanTargetDir: false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// This command registers the default task which will install bower packages into wwwroot/lib
|
||||
grunt.registerTask("default", ["bower:install"]);
|
||||
|
||||
// The following line loads the grunt plugins.
|
||||
// This line needs to be at the end of this this file.
|
||||
grunt.loadNpmTasks("grunt-bower-task");
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": "0.0.0",
|
||||
"name": "BasicWebSite",
|
||||
"description": "Web site demonstrating various validations.",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-bower-task": "^0.4.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,8 @@
|
|||
"include": [
|
||||
"Areas/Area1/Views",
|
||||
"Views",
|
||||
"web.config"
|
||||
"web.config",
|
||||
"wwwroot"
|
||||
]
|
||||
},
|
||||
"tools": {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue