Skip to content

Commit

Permalink
added the Refresh property to AjaxContinuation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Nov 15, 2011
1 parent 15aab95 commit d0da971
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -55,4 +55,3 @@ output/*
src/packages
repositories.config
results
fubuTemplate/lib/*
5 changes: 4 additions & 1 deletion src/FubuMVC.Core/Ajax/AjaxContinuation.cs
Expand Up @@ -57,12 +57,15 @@ public IList<AjaxError> Errors
public bool Success { get; set; }
public string Message { get; set; }

public bool ShouldRefresh { get; set; }

// *This* will be serialized to Json so that the resulting blob
// of json data is easier to work with in JavaScript
public virtual IDictionary<string, object> ToDictionary()
{
var dict = new Dictionary<string, object>{
{"success", Success}
{"success", Success},
{"refresh", ShouldRefresh}
};

Message.IfNotNull(x => dict.Add("message", x));
Expand Down
10 changes: 10 additions & 0 deletions src/FubuMVC.Tests/Ajax/AjaxContinuationTester.cs
Expand Up @@ -28,6 +28,16 @@ public void success_is_placed_into_the_dictionary()
theContinuation.ToDictionary()["success"].As<bool>().ShouldBeTrue();
}

[Test]
public void refresh_is_placed_int_the_dictionary()
{
theContinuation.ShouldRefresh = false;
theContinuation.ToDictionary()["refresh"].As<bool>().ShouldBeFalse();

theContinuation.ShouldRefresh = true;
theContinuation.ToDictionary()["refresh"].As<bool>().ShouldBeTrue();
}

[Test]
public void message_is_placed_into_the_dictionary_if_it_exists()
{
Expand Down

0 comments on commit d0da971

Please sign in to comment.