diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 412eeda..0000000 --- a/.gitattributes +++ /dev/null @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 4158ead..ca6bbf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,167 +1,4 @@ -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak +.sass* +*~ *.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.vspscc -.builds -*.dotCover -*.ncrunchsolution -*.ncrunchproject - -## TODO: If you have NuGet Package Restore enabled, uncomment this -packages/ -_NCrunch_*/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store -NuGetPackage/ +_site diff --git a/404.markdown b/404.markdown new file mode 100644 index 0000000..10a54ee --- /dev/null +++ b/404.markdown @@ -0,0 +1,4 @@ +--- +layout: default +title: Page not found +--- diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..8434ddc --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +linqtoquerystring.net \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 90ec7d3..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) 2013 Peter Smith - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/LinqToQueryString.IntegrationTests/App.config b/LinqToQueryString.IntegrationTests/App.config deleted file mode 100644 index f59175b..0000000 --- a/LinqToQueryString.IntegrationTests/App.config +++ /dev/null @@ -1,32 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LinqToQueryString.IntegrationTests/Exceptions.cs b/LinqToQueryString.IntegrationTests/Exceptions.cs deleted file mode 100644 index 03b6cb3..0000000 --- a/LinqToQueryString.IntegrationTests/Exceptions.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Data; - using System.Linq; - - using LinqToQuerystring; - - using Machine.Specifications; - - public class When_using_skip_on_unordered_data : SqlPagingAndOrdering - { - private static Exception ex; - - private Because of = () => ex = Catch.Exception(() => result = testDb.ConcreteCollection.LinqToQuerystring("?$skip=1").ToList()); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_trying_to_order_by_complex_types : SqlPagingAndOrdering - { - private static Exception ex; - - private Because of = () => ex = Catch.Exception(() => complexResult = testDb.ComplexCollection.LinqToQuerystring("?$orderby=concrete").ToList()); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_filtering_on_endswith_function : SqlFunctions - { - private static Exception ex; - - private Because of = () => ex = Catch.Exception(() => testDb.ConcreteCollection.LinqToQuerystring("?$filter=endswith(Name,'day')").ToList()); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - - private It should_fail_due_to_SQL_CE_not_supporting_endswith = - () => - ex.InnerException.Message.ShouldEqual("The function 'Reverse' is not supported by SQL Server Compact."); - } -} diff --git a/LinqToQueryString.IntegrationTests/LinqToQueryString.IntegrationTests.Sql.csproj b/LinqToQueryString.IntegrationTests/LinqToQueryString.IntegrationTests.Sql.csproj deleted file mode 100644 index 461ea91..0000000 --- a/LinqToQueryString.IntegrationTests/LinqToQueryString.IntegrationTests.Sql.csproj +++ /dev/null @@ -1,145 +0,0 @@ - - - - Debug - AnyCPU - {354C3452-BCDC-4048-B897-8CC719298B87} - Library - Properties - LinqToQueryString.IntegrationTests.Sql - LinqToQueryString.IntegrationTests.Sql - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - ..\ - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll - - - False - ..\packages\Machine.Fakes.2.0.0\lib\net40\Machine.Fakes.dll - - - False - ..\packages\Machine.Fakes.Moq.2.0.0\lib\net40\Machine.Fakes.Adapters.Moq.dll - - - False - ..\packages\Machine.Specifications.0.7.0-Unstable0077\lib\net40\Machine.Specifications.dll - - - False - ..\packages\Machine.Specifications.0.7.0-Unstable0077\lib\net40\Machine.Specifications.Clr4.dll - - - ..\packages\Machine.Specifications.Should.0.7.0-Unstable0008\lib\net40\Machine.Specifications.Should.dll - - - - False - ..\packages\Moq.4.2.1312.1622\lib\net40\Moq.dll - - - - - - - True - - - True - ..\packages\EntityFramework.SqlServerCompact.4.3.6\lib\net40\System.Data.SqlServerCe.Entity.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {139B0E4C-BC18-4180-8863-FB248CFDA42E} - LinqToQueryString.Tests - - - {7859C906-95D8-4322-AA44-BC854B065AEE} - LinqToQuerystring - - - - - - - False - - - False - - - False - - - False - - - - - - - - \ No newline at end of file diff --git a/LinqToQueryString.IntegrationTests/Properties/AssemblyInfo.cs b/LinqToQueryString.IntegrationTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 1d7c73d..0000000 --- a/LinqToQueryString.IntegrationTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LinqToQueryString.IntegrationTests.Sql")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LinqToQueryString")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d3add83d-6f36-402d-8ac7-7fb1beda13dd")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinqToQueryString.IntegrationTests/SqlCollectionAggregates.cs b/LinqToQueryString.IntegrationTests/SqlCollectionAggregates.cs deleted file mode 100644 index 24534cf..0000000 --- a/LinqToQueryString.IntegrationTests/SqlCollectionAggregates.cs +++ /dev/null @@ -1,421 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Collections.Generic; - using System.Data.Entity; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class SqlCollectionAggregates - { - protected static TestDbContext testDb; - - protected static List result; - - protected static List nullableResult; - - protected static IQueryable collection; - - protected static IQueryable nullableCollection; - - private Establish context = () => - { - testDb = new TestDbContext(); - Database.SetInitializer(new DropCreateDatabaseIfModelChanges()); - - testDb.Database.ExecuteSqlCommand("UPDATE ComplexClasses SET Concrete_Id = NULL"); - testDb.Database.ExecuteSqlCommand("DELETE FROM NullableValues"); - testDb.Database.ExecuteSqlCommand("DELETE FROM NullableContainers"); - testDb.Database.ExecuteSqlCommand("DELETE FROM EdgeCaseClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ConcreteClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ComplexClasses"); - - testDb.ComplexCollection.Add( - new ComplexClass - { - Title = "Charles", - Concrete = new ConcreteClass { Children = new List { new EdgeCaseClass { Name = "Apple" } } }, - ConcreteCollection = - new List - { - InstanceBuilders.BuildConcrete( - "Apple", 1, new DateTime(2005, 01, 01), true), - } - }); - - testDb.ComplexCollection.Add( - new ComplexClass - { - Title = "Andrew", - Concrete = new ConcreteClass { Children = new List { new EdgeCaseClass { Name = "Apple" }, new EdgeCaseClass { Name = "Banana" } } }, - ConcreteCollection = - new List - { - InstanceBuilders.BuildConcrete( - "Apple", 1, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete( - "Banana", - 2, - new DateTime(2003, 01, 01), - false) - } - }); - - testDb.ComplexCollection.Add( - new ComplexClass - { - Title = "David", - Concrete = new ConcreteClass { Children = new List { new EdgeCaseClass { Name = "Apple" }, new EdgeCaseClass { Name = "Banana" }, new EdgeCaseClass { Name = "Custard" } } }, - ConcreteCollection = - new List - { - InstanceBuilders.BuildConcrete( - "Apple", 1, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete( - "Banana", - 2, - new DateTime(2003, 01, 01), - false), - InstanceBuilders.BuildConcrete( - "Custard", - 3, - new DateTime(2007, 01, 01), - true) - } - }); - - testDb.ComplexCollection.Add( - new ComplexClass - { - Title = "Edward", - Concrete = new ConcreteClass { Children = new List { new EdgeCaseClass { Name = "Apple" }, new EdgeCaseClass { Name = "Custard" }, new EdgeCaseClass { Name = "Dogfood" }, new EdgeCaseClass { Name = "Eggs" } } }, - ConcreteCollection = - new List - { - InstanceBuilders.BuildConcrete( - "Apple", 1, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete( - "Custard", - 3, - new DateTime(2007, 01, 01), - true), - InstanceBuilders.BuildConcrete( - "Dogfood", - 4, - new DateTime(2009, 01, 01), - false), - InstanceBuilders.BuildConcrete( - "Eggs", 5, new DateTime(2000, 01, 01), true) - } - }); - - testDb.ComplexCollection.Add( - new ComplexClass - { - Title = "Boris", - Concrete = new ConcreteClass { Children = new List { new EdgeCaseClass { Name = "Apple" }, new EdgeCaseClass { Name = "Dogfood" }, new EdgeCaseClass { Name = "Eggs" } } }, - ConcreteCollection = - new List - { - InstanceBuilders.BuildConcrete( - "Apple", 1, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete( - "Dogfood", - 4, - new DateTime(2009, 01, 01), - false), - InstanceBuilders.BuildConcrete( - "Eggs", 5, new DateTime(2000, 01, 01), true) - } - }); - - testDb.SaveChanges(); - - testDb.NullableContainers.Add(new NullableContainer { Nullables = new List { new NullableValue { Age = null } } }); - testDb.NullableContainers.Add(new NullableContainer { Nullables = new List { new NullableValue { Age = 1 } } }); - testDb.NullableContainers.Add(new NullableContainer { Nullables = new List { new NullableValue { Age = 1 }, new NullableValue { Age = 2 } } }); - testDb.NullableContainers.Add(new NullableContainer { Nullables = new List { new NullableValue { Age = null }, new NullableValue { Age = 1 }, new NullableValue { Age = 2 } } }); - - testDb.SaveChanges(); - - collection = - testDb.ComplexCollection.Select( - o => - new ComplexClassDto - { - Title = o.Title, - StringCollection = o.ConcreteCollection.Select(c => c.Name), - IntCollection = o.ConcreteCollection.Select(c => c.Age), - ConcreteCollection = o.ConcreteCollection, - Concrete = o.Concrete - }); - - nullableCollection = testDb.NullableContainers.Select( - o => new NullableClassDto - { - NullableCollection = o.Nullables.Select(n => n.Age) - }); - - testDb = new TestDbContext(); - }; - } - - #region Int Collections - - public class When_filtering_on_a_simple_collection_property_using_max_against_an_int : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=IntCollection/max() eq 5").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_is_5 = () => result.ShouldEachConformTo(o => o.IntCollection.Max() == 5); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_an_int : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=IntCollection/min() eq 1").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_min_value_is_1 = () => result.ShouldEachConformTo(o => o.IntCollection.Min() == 1); - } - - public class When_filtering_on_a_simple_collection_property_using_sum_against_an_int : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=IntCollection/sum() gt 6").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_sum_of_values_is_greater_than_6 = () => result.ShouldEachConformTo(o => o.IntCollection.Sum() > 6); - } - - public class When_filtering_on_a_simple_collection_property_using_average_against_an_int : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=IntCollection/average() ge 2").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_average_of_values_is_greater_than_or_equal_to_2 = () => result.ShouldEachConformTo(o => o.IntCollection.Average() >= 2); - } - - #endregion - - #region Nullable Int Collections - - public class When_filtering_on_a_simple_collection_property_using_max_against_a_nullable_int : SqlCollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.LinqToQuerystring("$filter=NullableCollection/max() eq 2").ToList(); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_is_2 = () => nullableResult.ShouldEachConformTo(o => o.NullableCollection.Max() == 2); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_a_nullable_int : SqlCollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.LinqToQuerystring("$filter=NullableCollection/min() eq 1").ToList(); - - private It should_return_three_records = () => nullableResult.Count().ShouldEqual(3); - - private It should_only_return_records_where_min_value_is_1 = () => nullableResult.ShouldEachConformTo(o => o.NullableCollection.Min() == 1); - } - - public class When_filtering_on_a_simple_collection_property_using_sum_against_a_nullable_int : SqlCollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.LinqToQuerystring("$filter=NullableCollection/sum() gt 2").ToList(); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_sum_of_values_is_greater_than_2 = () => nullableResult.ShouldEachConformTo(o => o.NullableCollection.Sum() > 2); - } - - public class When_filtering_on_a_simple_collection_property_using_average_against_a_nullable_int : SqlCollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.LinqToQuerystring("$filter=NullableCollection/average() ge 1").ToList(); - - private It should_return_three_records = () => nullableResult.Count().ShouldEqual(3); - - private It should_only_return_records_where_average_of_values_is_greater_than_or_equal_to_1 = () => nullableResult.ShouldEachConformTo(o => o.NullableCollection.Average() >= 1); - } - - public class When_filtering_on_a_nullable_int_collection_property_using_any_checking_for_nulls : SqlCollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.LinqToQuerystring("$filter=NullableCollection/any(int: int eq null)").ToList(); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_banana = () => nullableResult.ShouldEachConformTo(o => o.NullableCollection.Any(s => s == null)); - } - - #endregion - - #region String collections - - public class When_filtering_on_a_simple_collection_property_using_any : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/any(tag: tag eq 'Banana')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_banana = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s == "Banana")); - } - - public class When_filtering_on_a_simple_collection_property_using_any_with_an_or : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/any(tag: tag eq 'Banana' or tag eq 'Eggs')").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_string_collection_contains_banana_or_eggs = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s == "Banana" || s == "Eggs")); - } - - public class When_filtering_on_a_simple_collection_property_using_any_with_functions : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/any(tag: startswith(tag,'Dog'))").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_value_starting_with_dog = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s.StartsWith("Dog"))); - } - - public class When_filtering_on_a_simple_collection_property_using_all : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/all(tag: tag eq 'Apple')").ToList(); - - private It should_return_one_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_string_collection_records_are_apple = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s == "Apple")); - } - - public class When_filtering_on_a_simple_collection_property_using_all_with_an_or : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/all(tag: tag eq 'Apple' or tag eq 'Banana')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_all_string_collection_records_are_apple_or_banana = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s == "Apple" || s == "Banana")); - } - - public class When_filtering_on_a_simple_collection_property_using_all_with_functions : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/all(tag: startswith(tag,'App'))").ToList(); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_string_collection_records_start_with_app = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s.StartsWith("App"))); - } - - public class When_filtering_on_a_simple_collection_property_using_count : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/count() ge 3").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_string_collection_count_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.StringCollection.Count() >= 3); - } - - public class When_filtering_on_a_simple_collection_property_using_max_against_a_string : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/max() eq 'Eggs'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_of_string_collection_is_eggs = () => result.ShouldEachConformTo(o => o.StringCollection.Max() == "Eggs"); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_a_string : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=StringCollection/min() eq 'Apple'").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_min_value_of_string_collection_is_apple = () => result.ShouldEachConformTo(o => o.StringCollection.Min() == "Apple"); - } - - #endregion - - #region Complex collections - - public class When_filtering_on_a_complex_collection_property_using_any : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/any(concrete: concrete/Name eq 'Banana')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_banana = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name == "Banana")); - } - - public class When_filtering_on_a_complex_collection_property_using_any_with_an_or : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/any(concrete: concrete/Name eq 'Banana' or concrete/Name eq 'Eggs')").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_banana_or_eggs = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name == "Banana" || s.Name == "Eggs")); - } - - public class When_filtering_on_a_complex_collection_property_using_any_with_functions : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/any(concrete: startswith(concrete/Name,'Dog'))").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_starting_with_dog = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name.StartsWith("Dog"))); - } - - public class When_filtering_on_a_complex_collection_property_using_all : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/all(concrete: concrete/Name eq 'Apple')").ToList(); - - private It should_return_one_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_apple = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name == "Apple")); - } - - public class When_filtering_on_a_complex_collection_property_using_all_with_an_or : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/all(concrete: concrete/Name eq 'Apple' or concrete/Name eq 'Banana')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_apple_or_banana = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name == "Apple" || s.Name == "Banana")); - } - - public class When_filtering_on_a_complex_collection_property_using_all_with_functions : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/all(concrete: startswith(concrete/Name,'App'))").ToList(); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_starting_with_app = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name.StartsWith("App"))); - } - - public class When_filtering_on_a_complex_collection_property_using_count : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=ConcreteCollection/count() ge 3").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_concrete_collection_count_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Count() >= 3); - } - - #endregion - - #region Nested Complex collections - - public class When_filtering_on_a_nested_simple_collection_property_using_any : SqlCollectionAggregates - { - private Because of = () => result = collection.LinqToQuerystring("$filter=Concrete/Children/any(child: child/Name eq 'Banana')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_contains_child_with_name_banana = () => result.ShouldEachConformTo(o => o.Concrete.Children.Any(s => s.Name == "Banana")); - } - - #endregion -} diff --git a/LinqToQueryString.IntegrationTests/SqlFiltering.cs b/LinqToQueryString.IntegrationTests/SqlFiltering.cs deleted file mode 100644 index f33c2ae..0000000 --- a/LinqToQueryString.IntegrationTests/SqlFiltering.cs +++ /dev/null @@ -1,1593 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Collections.Generic; - using System.Data.Entity; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class SqlFiltering - { - protected static TestDbContext testDb; - - protected static List result; - - protected static List edgeCaseResult; - - protected static List nullableResult; - - protected static List concreteCollection; - - protected static List edgeCaseCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - testDb = new TestDbContext(); - Database.SetInitializer(new DropCreateDatabaseIfModelChanges()); - - testDb.Database.ExecuteSqlCommand("UPDATE ComplexClasses SET Concrete_Id = NULL"); - testDb.Database.ExecuteSqlCommand("DELETE FROM EdgeCaseClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ConcreteClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ComplexClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM NullableClasses"); - - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Apple", 1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, 0.1m, guidArray[0])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Apple", 2, new DateTime(2005, 01, 01), false, 30000000000, 333.333, 333.333f, 0x22, 0.3m, guidArray[2])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Custard", 1, new DateTime(2003, 01, 01), true, 50000000000, 555.555, 555.555f, 0xDD, 0.5m, guidArray[4])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Custard", 2, new DateTime(2002, 01, 01), false, 30000000000, 333.333, 333.333f, 0x00, 0.3m, guidArray[2])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2002, 01, 01), true, 40000000000, 444.444, 444.444f, 0x22, 0.4m, guidArray[3])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Banana", 3, new DateTime(2003, 01, 01), false, 10000000000, 111.111, 111.111f, 0x00, 0.1m, guidArray[0])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2005, 01, 01), true, 40000000000, 444.444, 444.444f, 0xCC, 0.4m, guidArray[3])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Eggs", 3, new DateTime(2001, 01, 01), false, 20000000000, 222.222, 222.222f, 0xCC, 0.2m, guidArray[1])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2003, 01, 01), true, 30000000000, 333.333, 333.333f, 0xEE, 0.3m, guidArray[2])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2004, 01, 01), false, 10000000000, 111.111, 111.111f, 0xDD, 0.1m, guidArray[0])); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Dogfood", 5, new DateTime(2001, 01, 01), true, 20000000000, 222.222, 222.222f, 0xCC, 0.2m, guidArray[1])); - - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\\Bob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\bBob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\tBob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\nBob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\fBob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\rBob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple\"Bob", 1, new DateTime(2002, 01, 01), true)); - testDb.EdgeCaseCollection.Add(InstanceBuilders.BuildEdgeCase("Apple'Bob", 1, new DateTime(2002, 01, 01), true)); - - testDb.NullableCollection.Add(InstanceBuilders.BuildNull()); - testDb.NullableCollection.Add(InstanceBuilders.BuildNull(1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, guidArray[0])); - - testDb.SaveChanges(); - - concreteCollection = testDb.ConcreteCollection.ToList(); - edgeCaseCollection = testDb.EdgeCaseCollection.ToList(); - nullableCollection = testDb.NullableCollection.ToList(); - - testDb = new TestDbContext(); - }; - } - - #region Filter on implicit boolean identifiers - - public class When_specifying_a_single_boolean_identifier_as_a_filter : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Complete").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Complete); - } - - public class When_specifying_a_negated_single_boolean_identifier_as_a_filter : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Complete").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => !o.Complete); - } - - #endregion - - #region Filter on string tests - - public class When_using_eq_filter_on_a_single_string : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Apple'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_string_with_reversed_parameters : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter='Apple' eq Name").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_not_eq_filter_on_a_single_string : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Name eq 'Apple'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_name_is_not_apple = () => result.ShouldEachConformTo(o => o.Name != "Apple"); - } - - public class When_using_ne_filter_on_a_single_string : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name ne 'Apple'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_name_is_not_apple = () => result.ShouldEachConformTo(o => o.Name != "Apple"); - } - - public class When_using_not_ne_filter_on_a_single_string : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Name ne 'Apple'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - #endregion - - #region Filter on string escape character tests - - public class When_using_eq_filter_on_a_single_string_with_escaped_slash : SqlFiltering - { - private Because of = - () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\\Bob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\\Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_backspace : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\bBob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\bBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_tab : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\tBob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\tBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_newline : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\nBob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\nBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_formfeed : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\fBob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\fBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_carriage_return : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\rBob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple\rBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_quote : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple""Bob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == @"Apple""Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_double_escaped_single_quote : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple''Bob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple'Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_single_quote : SqlFiltering - { - private Because of = () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=Name eq 'Apple\'Bob'").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => edgeCaseResult.ShouldEachConformTo(o => o.Name == "Apple'Bob"); - } - - #endregion - - #region Filter on int tests - - public class When_using_eq_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age eq 4").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age == 4); - } - - public class When_using_eq_filter_on_a_negative_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age gt -4").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age > -4); - } - - - public class When_using_not_eq_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age eq 4").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_age_is_not_4 = () => result.ShouldEachConformTo(o => o.Age != 4); - } - - public class When_using_ne_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age ne 4").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_age_is_not_4 = () => result.ShouldEachConformTo(o => o.Age != 4); - } - - public class When_using_not_ne_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age ne 4").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age == 4); - } - - public class When_using_gt_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age gt 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.Age > 3); - } - - public class When_using_not_gt_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age gt 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_greater_than_3 = () => result.ShouldEachConformTo(o => !(o.Age > 3)); - } - - public class When_using_ge_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age ge 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Age >= 3); - } - - public class When_using_not_ge_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age ge 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Age >= 3)); - } - - public class When_using_lt_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age lt 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_less_than_3 = () => result.ShouldEachConformTo(o => o.Age < 3); - } - - public class When_using_not_lt_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age lt 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_not_less_than_3 = () => result.ShouldEachConformTo(o => !(o.Age < 3)); - } - - public class When_using_le_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Age le 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Age <= 3); - } - - public class When_using_not_le_filter_on_a_single_int : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Age le 3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_not_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Age <= 3)); - } - - #endregion - - #region Filter on long tests - - public class When_using_eq_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population eq 40000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_population_is_40000000000 = () => result.ShouldEachConformTo(o => o.Population == 40000000000); - } - - public class When_using_eq_filter_on_a_negative_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population gt -40000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age > -40000000000); - } - - public class When_using_not_eq_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population eq 40000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_population_is_not_40000000000 = () => result.ShouldEachConformTo(o => o.Population != 40000000000); - } - - public class When_using_ne_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population ne 40000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_population_is_not_40000000000 = () => result.ShouldEachConformTo(o => o.Population != 40000000000); - } - - public class When_using_not_ne_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population ne 40000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_population_is_40000000000 = () => result.ShouldEachConformTo(o => o.Population == 40000000000); - } - - public class When_using_gt_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population gt 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_population_is_greater_than_30000000000 = () => result.ShouldEachConformTo(o => o.Population > 30000000000); - } - - public class When_using_not_gt_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population gt 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_population_is_not_greater_than_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population > 30000000000)); - } - - public class When_using_ge_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population ge 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_population_is_greater_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => o.Population >= 30000000000); - } - - public class When_using_not_ge_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population ge 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_population_is_not_greater_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population >= 30000000000)); - } - - public class When_using_lt_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population lt 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_population_is_less_than_30000000000 = () => result.ShouldEachConformTo(o => o.Population < 30000000000); - } - - public class When_using_not_lt_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population lt 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_population_is_not_less_than_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population < 30000000000)); - } - - public class When_using_le_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Population le 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_population_is_less_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => o.Population <= 30000000000); - } - - public class When_using_not_le_filter_on_a_single_long : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Population le 30000000000L").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_population_is_not_less_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population <= 0000000000)); - } - - #endregion - - #region Filter on byte tests - - public class When_using_eq_filter_on_a_single_byte_numerically : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code eq 34").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_eq_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code eq 0x22").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_not_eq_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code eq 0x22").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_code_is_not_0x22 = () => result.ShouldEachConformTo(o => o.Code != 0x22); - } - - public class When_using_ne_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code ne 0x22").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_code_is_not_0x22 = () => result.ShouldEachConformTo(o => o.Code != 0x22); - } - - public class When_using_not_ne_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code ne 0x22").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_gt_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code gt 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_code_is_greater_than_0xCC = () => result.ShouldEachConformTo(o => o.Code > 0xCC); - } - - public class When_using_not_gt_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code gt 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_code_is_not_greater_than_0xCC = () => result.ShouldEachConformTo(o => !(o.Code > 0xCC)); - } - - public class When_using_ge_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code ge 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_code_is_greater_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => o.Code >= 0xCC); - } - - public class When_using_not_ge_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code ge 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_code_is_not_greater_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => !(o.Code >= 0xCC)); - } - - public class When_using_lt_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code lt 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_code_is_less_than_0xCC = () => result.ShouldEachConformTo(o => o.Code < 0xCC); - } - - public class When_using_not_lt_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code lt 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_code_is_not_less_than_0xCC = () => result.ShouldEachConformTo(o => !(o.Code < 0xCC)); - } - - public class When_using_le_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Code le 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_code_is_less_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => o.Code <= 0xCC); - } - - public class When_using_not_le_filter_on_a_single_byte : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Code le 0xCC").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_code_is_not_less_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => !(o.Code <= 0000000000)); - } - - #endregion - - #region Filter on guid tests - - public class When_using_eq_filter_on_a_single_guid : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring(string.Format("?$filter=Guid eq guid'{0}'", guidArray[1])).ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid == guidArray[1]); - } - - public class When_using_not_eq_filter_on_a_single_guid : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring(string.Format("?$filter=not Guid eq guid'{0}'", guidArray[1])).ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid != guidArray[1]); - } - - public class When_using_ne_filter_on_a_single_guid : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring(string.Format("?$filter=Guid ne guid'{0}'", guidArray[1])).ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid != guidArray[1]); - } - - public class When_using_not_ne_filter_on_a_single_guid : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring(string.Format("?$filter=not Guid ne guid'{0}'", guidArray[1])).ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid == guidArray[1]); - } - - #endregion - - #region Filter on single tests - - public class When_using_eq_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost eq 444.444f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_cost_is_444point444 = () => result.ShouldEachConformTo(o => o.Cost == 444.444f); - } - - public class When_using_eq_filter_on_a_negative_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost gt -444.444f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Cost > -444.444f); - } - - public class When_using_not_eq_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost eq 444.444f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_cost_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Cost != 444.444f); - } - - public class When_using_ne_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost ne 444.444f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_cost_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Cost != 444.444f); - } - - public class When_using_not_ne_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost ne 444.444f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_cost_is_444point444 = () => result.ShouldEachConformTo(o => o.Cost == 444.444f); - } - - public class When_using_gt_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost gt 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_cost_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Cost > 333.333f); - } - - public class When_using_not_gt_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost gt 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_cost_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost > 333.333f)); - } - - public class When_using_ge_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost ge 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_cost_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Cost >= 333.333f); - } - - public class When_using_not_ge_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost ge 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_cost_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost >= 333.333f)); - } - - public class When_using_lt_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost lt 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_cost_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Cost < 333.333f); - } - - public class When_using_not_lt_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost lt 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_cost_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost < 333.333f)); - } - - public class When_using_le_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Cost le 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_cost_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Cost <= 333.333f); - } - - public class When_using_not_le_filter_on_a_single_single : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Cost le 333.333f").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_cost_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost <= 333.333f)); - } - - #endregion - - #region Filter on double tests - - public class When_using_eq_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value eq 444.444").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Value == 444.444); - } - - public class When_using_eq_filter_on_a_negative_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value gt -444.444").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Value > -444.444); - } - - public class When_using_not_eq_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value eq 444.444").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Value != 444.444); - } - - public class When_using_ne_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value ne 444.444").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Value != 444.444); - } - - public class When_using_not_ne_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value ne 444.444").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Value == 444.444); - } - - public class When_using_gt_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value gt 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Value > 333.333); - } - - public class When_using_not_gt_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value gt 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Value > 333.333)); - } - - public class When_using_ge_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value ge 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Value >= 333.333); - } - - public class When_using_not_ge_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value ge 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Value >= 333.333)); - } - - public class When_using_lt_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value lt 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Value < 333.333); - } - - public class When_using_not_lt_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value lt 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Value < 333.333)); - } - - public class When_using_le_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Value le 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Value <= 333.333); - } - - public class When_using_not_le_filter_on_a_single_double : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Value le 333.333").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Value <= 333.333)); - } - - #endregion - - #region Filter on decimal tests - - public class When_using_eq_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score eq 0.4m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_Score_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_eq_filter_on_a_negative_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score gt -0.4m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Score > -0.4m); - } - - public class When_using_not_eq_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score eq 0.4m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_Score_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Score != 0.4m); - } - - public class When_using_ne_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score ne 0.4m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_Score_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Score != 0.4m); - } - - public class When_using_not_ne_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score ne 0.4m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_Score_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_gt_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score gt 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_Score_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Score > 0.3m); - } - - public class When_using_not_gt_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score gt 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_Score_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Score > 0.3m)); - } - - public class When_using_ge_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score ge 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_Score_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Score >= 0.3m); - } - - public class When_using_not_ge_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score ge 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_Score_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Score >= 0.3m)); - } - - public class When_using_lt_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score lt 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_Score_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Score < 0.3m); - } - - public class When_using_not_lt_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score lt 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_Score_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Score < 0.3m)); - } - - public class When_using_le_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Score le 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_Score_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Score <= 0.3m); - } - - public class When_using_not_le_filter_on_a_single_decimal : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Score le 0.3m").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_Score_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Score <= 0.3m)); - } - - #endregion - - #region Filter on date tests - - public class When_using_eq_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date eq datetime'2002-01-01T00:00'").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_date_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_not_eq_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date eq datetime'2002-01-01T00:00'").ToList(); - - private It should_return_eight_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date != new DateTime(2002, 01, 01)); - } - - public class When_using_ne_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date ne datetime'2002-01-01T00:00'").ToList(); - - private It should_return_eight_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date != new DateTime(2002, 01, 01)); - } - - public class When_using_not_ne_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date ne datetime'2002-01-01T00:00'").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_gt_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date gt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.Date > new DateTime(2003, 01, 01)); - } - - public class When_using_not_gt_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date gt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_greater_than_3 = () => result.ShouldEachConformTo(o => !(o.Date > new DateTime(2003, 01, 01))); - } - - public class When_using_ge_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date ge datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Date >= new DateTime(2003, 01, 01)); - } - - public class When_using_not_ge_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date ge datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Date >= new DateTime(2003, 01, 01))); - } - - public class When_using_lt_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date lt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_less_than_3 = () => result.ShouldEachConformTo(o => o.Date < new DateTime(2003, 01, 01)); - } - - public class When_using_not_lt_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date lt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_not_less_than_3 = () => result.ShouldEachConformTo(o => !(o.Date < new DateTime(2003, 01, 01))); - } - - public class When_using_le_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Date le datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Date <= new DateTime(2003, 01, 01)); - } - - public class When_using_not_le_filter_on_a_single_date : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Date le datetime'2003-01-01T00:00'").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_not_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Date <= new DateTime(2003, 01, 01))); - } - - #endregion - - #region Filter on bool tests - - public class When_using_eq_filter_on_a_single_bool : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Complete eq true").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_bool_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Complete); - } - - public class When_using_not_eq_filter_on_a_single_bool : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Complete eq true").ToList(); - - private It should_return_eight_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => !o.Complete); - } - - public class When_using_ne_filter_on_a_single_bool : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Complete ne true").ToList(); - - private It should_return_eight_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => !o.Complete); - } - - public class When_using_not_ne_filter_on_a_single_bool : SqlFiltering - { - private Because of = () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not Complete ne true").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Complete); - } - - #endregion - - #region Filter on nullable ints - - //eq - public class When_using_eq_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age eq 1").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - public class When_using_eq_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=1 eq Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - //ne - public class When_using_ne_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age ne 1").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != 1); - } - - public class When_using_ne_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=1 ne Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != 1); - } - - //gt - public class When_using_gt_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age gt 0").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age > 0); - } - - public class When_using_gt_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=2 gt Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 2 > o.Age); - } - - //ge - public class When_using_ge_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age ge 1").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age >= 1); - } - - public class When_using_ge_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=1 ge Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 1 >= o.Age); - } - - //lt - public class When_using_lt_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age lt 2").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age < 2); - } - - public class When_using_lt_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=0 lt Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 0 < o.Age); - } - - //le - public class When_using_le_filter_on_a_single_nullable_int : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age le 1").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - public class When_using_le_filter_on_a_single_nullable_int_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=1 le Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 1 <= o.Age); - } - - //not - - #endregion - - #region Filter with comparison to nulls - - //eq - public class When_using_eq_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age eq null").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == null); - } - - public class When_using_eq_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null eq Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == null); - } - - //ne - public class When_using_ne_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age ne null").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != null); - } - - public class When_using_ne_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null ne Age").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != null); - } - - //gt - public class When_using_gt_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age gt null").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_gt_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null gt Age").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //ge - public class When_using_ge_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age ge null").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_ge_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null ge Age").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //lt - public class When_using_lt_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age lt null").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_lt_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null lt Age").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //le - public class When_using_le_filter_null_comparison : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Age le null").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_le_filter_null_comparison_with_operands_reversed : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=null le Age").ToList(); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //not - - #endregion - - #region Filter on other nullable types - - public class When_using_eq_filter_on_a_single_nullable_date : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Date eq datetime'2002-01-01T00:00'").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_equal_true : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Complete eq true").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_implicit : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Complete").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_equal_false : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Complete eq false").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(0); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == false); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_not_true : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=not Complete eq true").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_implicit_not : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=not Complete").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_not_false : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=not Complete eq false").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != false); - } - - public class When_using_eq_filter_on_a_single_nullable_long : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Population eq 10000000000L").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Population == 10000000000L); - } - - public class When_using_eq_filter_on_a_single_nullable_double : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Value eq 111.111").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Value == 111.111); - } - - public class When_using_eq_filter_on_a_single_nullable_float : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Cost eq 111.111f").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Cost == 111.111f); - } - - public class When_using_eq_filter_on_a_single_nullable_byte : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$filter=Code eq 0x00").ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Code == 0x00); - } - - public class When_using_eq_filter_on_a_single_nullable_guid : SqlFiltering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring(string.Format("?$filter=Guid eq guid'{0}'", guidArray[0])).ToList(); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Guid == guidArray[0]); - } - - #endregion - - #region Simple Logic Tests - - public class When_anding_two_filters_together : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Custard' and Age ge 2").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard = - () => result.ShouldEachConformTo(o => o.Name == "Custard"); - - private It should_only_return_records_with_age_greater_than_or_equal_to_2 = - () => result.ShouldEachConformTo(o => o.Age >= 2); - } - - public class When_anding_a_filter_and_a_not_filter : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Custard' and not Age lt 2").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard = - () => result.ShouldEachConformTo(o => o.Name == "Custard"); - - private It should_only_return_records_with_age_greater_than_or_equal_to_2 = - () => result.ShouldEachConformTo(o => o.Age >= 2); - } - - public class When_oring_two_filters_together : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Banana' or Date gt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_banana_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Banana" || o.Date > new DateTime(2003, 01, 01)); - } - - public class When_oring_a_filter_and_a_not_filter : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Banana' or not Date le datetime'2003-01-01T00:00'").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_banana_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Banana" || o.Date > new DateTime(2003, 01, 01)); - } - - #endregion - - #region Operator Precedence and Parenthesis tests - - public class When_combining_and_or_filters_together : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Apple' and Complete eq true or Date gt datetime'2003-01-01T00:00'").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_apples_complete_equal_to_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Apple" && o.Complete || o.Date > new DateTime(2003, 01, 01)); - } - - public class When_combining_and_or_not_filters_together : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Apple' and Complete eq true or not Date le datetime'2003-01-01T00:00'").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It - should_only_return_records_with_name_equal_to_apples_complete_equal_to_true_or_date_not_less_than_2003_01_01 - = () => result.ShouldEachConformTo(o => o.Name == "Apple" && o.Complete || !(o.Date <= new DateTime(2003, 01, 01))); - } - - public class When_using_parenthesis : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=Name eq 'Apple' and (Complete eq true or Date gt datetime'2003-01-01T00:00')").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard_and_result_of_complete_equals_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Apple" && (o.Complete || o.Date > new DateTime(2003, 01, 01))); - } - - public class When_notting_an_entire_parenthesised_expression : SqlFiltering - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=not (Name eq 'Apple' and (Complete eq true or Date gt datetime'2003-01-01T00:00'))").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_with_name_equal_to_custard_and_result_of_complete_equals_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => !(o.Name == "Apple" && (o.Complete || o.Date > new DateTime(2003, 01, 01)))); - } - - #endregion -} diff --git a/LinqToQueryString.IntegrationTests/SqlFunctions.cs b/LinqToQueryString.IntegrationTests/SqlFunctions.cs deleted file mode 100644 index 19e2f90..0000000 --- a/LinqToQueryString.IntegrationTests/SqlFunctions.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Collections.Generic; - using System.Data.Entity; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class SqlFunctions - { - protected static TestDbContext testDb; - - protected static List result; - - protected static List concreteCollection; - - private Establish context = () => - { - testDb = new TestDbContext(); - - testDb.Database.ExecuteSqlCommand("UPDATE ComplexClasses SET Concrete_Id = NULL"); - testDb.Database.ExecuteSqlCommand("DELETE FROM EdgeCaseClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ConcreteClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ComplexClasses"); - - testDb.ConcreteCollection.Add( - InstanceBuilders.BuildConcrete("Saturday", 1, new DateTime(2001, 01, 01), true)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Satnav", 2, new DateTime(2002, 01, 01), false)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Saturnalia", 3, new DateTime(2003, 01, 01), true)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Saturn", 4, new DateTime(2004, 01, 01), true)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Monday", 5, new DateTime(2005, 01, 01), true)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Tuesday", 5, new DateTime(2005, 01, 01), true)); - testDb.ConcreteCollection.Add(InstanceBuilders.BuildConcrete("Burns", 5, new DateTime(2005, 01, 01), true)); - - testDb.SaveChanges(); - - concreteCollection = testDb.ConcreteCollection.ToList(); - - testDb = new TestDbContext(); - }; - } - - public class When_filtering_on_startswith_function : SqlFunctions - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=startswith(Name,'Sat')").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_starts_with_Sat = - () => result.ShouldEachConformTo(o => o.Name.StartsWith("Sat")); - } - - public class When_filtering_on_substringof_function : SqlFunctions - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring("?$filter=substringof('urn',Name)").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => o.Name.Contains("urn")); - } - - public class When_filtering_on_multiple_substringof_functions : SqlFunctions - { - private Because of = - () => - result = - testDb.ConcreteCollection.LinqToQuerystring( - "?$filter=(substringof('Mond',Name)) or (substringof('Tues',Name))").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => o.Name.Contains("Mond") || o.Name.Contains("Tues")); - } - - public class When_filtering_on_substringof_function_with_escape_character : SqlFiltering - { - private Because of = - () => edgeCaseResult = testDb.EdgeCaseCollection.LinqToQuerystring(@"?$filter=substringof('\\',Name)").ToList(); - - private It should_return_one_record = () => edgeCaseResult.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_contains_escaped_slash = - () => edgeCaseResult.ShouldEachConformTo(o => o.Name.Contains("\\")); - } - - public class When_filtering_on_substringof_function_with_tolower : SqlFunctions - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring(@"?$filter=substringof('sat',tolower(Name))").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_contains_sat = - () => result.ShouldEachConformTo(o => o.Name.Contains("Sat")); - } - - public class When_filtering_on_substringof_function_with_toupper : SqlFunctions - { - private Because of = - () => result = testDb.ConcreteCollection.LinqToQuerystring(@"?$filter=substringof('SAT',toupper(Name))").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_contains_sat = - () => result.ShouldEachConformTo(o => o.Name.Contains("Sat")); - } -} diff --git a/LinqToQueryString.IntegrationTests/SqlInlineCount.cs b/LinqToQueryString.IntegrationTests/SqlInlineCount.cs deleted file mode 100644 index 5958f54..0000000 --- a/LinqToQueryString.IntegrationTests/SqlInlineCount.cs +++ /dev/null @@ -1,212 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public class SqlInlineCount : SqlProjection - { - protected static Dictionary inlineCountResult; - - protected static List concreteResult; - - protected static List GetWrappedResults() - { - return (inlineCountResult["Results"] as IQueryable).ToList(); - } - - protected static List> GetWrappedProjectedResults() - { - return (inlineCountResult["Results"] as IQueryable>).ToList(); - } - } - - public class When_requesting_inline_count_none : SqlInlineCount - { - Because of = () => concreteResult = testDb.ConcreteCollection.LinqToQuerystring("?$inlinecount=none").ToList(); - - private It should_return_all_the_records_normally = () => concreteResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => concreteResult.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => concreteResult.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => concreteResult.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => concreteResult.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => concreteResult.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_an_unfiltered_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(5); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_projected_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(5); - - private It should_project_the_name_and_age_properties_into_the_dictionary = - () => GetWrappedProjectedResults().ShouldEachConformTo( - r => r.ContainsKey("Name") && r.ContainsKey("Age")); - - private It should_only_have_projected_two_properties = - () => GetWrappedProjectedResults().ShouldEachConformTo(r => r.Count == 2); - - private It should_project_the_right_name_for_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_project_the_right_name_for_the_second_record = () => GetWrappedProjectedResults().ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_project_the_right_name_for_the_third_record = () => GetWrappedProjectedResults().ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_project_the_right_name_for_the_fourth_record = () => GetWrappedProjectedResults().ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It sshould_project_the_right_name_for_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - - private It should_project_the_right_age_for_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_project_the_right_age_for_the_second_record = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_project_the_right_age_for_the_third_record = () => GetWrappedProjectedResults().ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_project_the_right_age_for_the_fourth_record = () => GetWrappedProjectedResults().ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_project_the_right_age_for_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_filtered_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$filter=Age ge 3&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(3); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_an_ordered_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Age desc&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(5); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_requesting_inline_count_on_a_top_limited_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$top=3&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(3); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - public class When_requesting_inline_count_on_a_top_limited_projected_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Name&$top=3&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(3); - - private It should_return_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedProjectedResults().ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - } - - public class When_requesting_inline_count_on_a_paged_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Name&$skip=2&$top=2&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(2); - - private It should_return_the_second_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_paged_projected_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Name&$skip=2&$top=2&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(2); - - private It should_return_the_second_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_filtered_paged_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Name&$filter=Age ge 3&$skip=2&$top=2&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(1); - - private It should_return_the_fifth_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_filtered_paged_projected_query : SqlInlineCount - { - Because of = () => inlineCountResult = testDb.ConcreteCollection.LinqToQuerystring>("?$orderby=Name&$filter=Age ge 3&$skip=2&$top=2&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(1); - - private It should_return_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } -} diff --git a/LinqToQueryString.IntegrationTests/SqlPagingAndOrdering.cs b/LinqToQueryString.IntegrationTests/SqlPagingAndOrdering.cs deleted file mode 100644 index f3263be..0000000 --- a/LinqToQueryString.IntegrationTests/SqlPagingAndOrdering.cs +++ /dev/null @@ -1,756 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Collections.Generic; - using System.Data.Entity; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public class SqlPagingAndOrdering - { - protected static TestDbContext testDb; - - protected static List result; - - protected static List complexResult; - - protected static List nullableResult; - - protected static List concreteCollection; - - protected static List complexCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - testDb = new TestDbContext(); - - testDb.Database.ExecuteSqlCommand("UPDATE ComplexClasses SET Concrete_Id = NULL"); - testDb.Database.ExecuteSqlCommand("DELETE FROM EdgeCaseClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ConcreteClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ComplexClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM NullableClasses"); - - testDb.ComplexCollection.Add(new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) }); - - testDb.NullableCollection.Add(InstanceBuilders.BuildNull(3, new DateTime(2003, 01, 01), true, 30000000000, 333.333, 333.333f, 0xEE, guidArray[2])); - testDb.NullableCollection.Add(InstanceBuilders.BuildNull(1, new DateTime(2001, 01, 01), false, 10000000000, 111.111, 111.111f, 0xDD, guidArray[0])); - testDb.NullableCollection.Add(InstanceBuilders.BuildNull()); - testDb.NullableCollection.Add(InstanceBuilders.BuildNull(2, new DateTime(2002, 01, 01), true, 20000000000, 222.222, 222.222f, 0xCC, guidArray[1])); - - testDb.SaveChanges(); - - concreteCollection = testDb.ConcreteCollection.ToList(); - complexCollection = testDb.ComplexCollection.ToList(); - nullableCollection = testDb.NullableCollection.ToList(); - - testDb = new TestDbContext(); - }; - } - - #region Top Tests - - public class When_using_top_1 : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$top=1").ToList(); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_top_3 : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$top=3").ToList(); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_start_with_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_follow_with_the_second_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_follow_with_the_third_record = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - #endregion - - #region Skip Tests - - public class When_using_skip_1_on_ordered_data : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Id&$skip=1").ToList(); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_start_with_the_second_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_follow_with_the_third_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_follow_with_the_fifth_record = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_skip_3_on_ordered_data : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Id$skip=3").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_follow_with_the_fifth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - #endregion - - #region Skip and Top Tests - - public class When_using_skip_2_and_top_2_on_ordered_data : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Id$skip=2&$top=2").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_skip_3_and_top_1_on_ordered_data : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Id$skip=3&$top=1").ToList(); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_start_with_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_top_2_and_skip_2_on_ordered_data : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Id$top=2&$skip=2").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_top_2_and_skip_2_on_ordered_data_but_orderby_is_at_the_end : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$top=2&$skip=2$orderby=Id").ToList(); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Single Integer Tests - - public class When_using_order_by_on_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_asc_on_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age asc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_desc_on_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Nullable Integer Tests - - public class When_using_order_by_on_nullable_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Age").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - } - - public class When_using_order_by_asc_on_nullable_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Age asc").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - } - - public class When_using_order_by_desc_on_nullable_integer_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Age desc").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_first_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_third = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - } - - #endregion - - - #region OrderBy Single String Tests - - public class When_using_order_by_on_string_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_asc_on_string_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name asc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_desc_on_string_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - #endregion - - #region OrderBy Single Date Tests - - public class When_using_order_by_on_date_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_asc_on_date_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date asc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_desc_on_date_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Single Boolean Tests - - public class When_using_order_by_on_bool_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_false_value_first = () => result.ElementAt(0).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_second = () => result.ElementAt(1).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fourth = () => result.ElementAt(3).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fifth = () => result.ElementAt(4).Complete.ShouldBeTrue(); - } - - public class When_using_order_by_asc_on_bool_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete asc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_false_value_first = () => result.ElementAt(0).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_second = () => result.ElementAt(1).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fourth = () => result.ElementAt(3).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fifth = () => result.ElementAt(4).Complete.ShouldBeTrue(); - } - - public class When_using_order_by_desc_on_bool_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_true_value_first = () => result.ElementAt(0).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_second = () => result.ElementAt(1).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_false_value_fourth = () => result.ElementAt(3).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_fifth = () => result.ElementAt(4).Complete.ShouldBeFalse(); - } - - #endregion - - #region OrderBy Nullable Boolean Tests - - public class When_using_order_by_on_nullable_boolean_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Complete").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - } - - public class When_using_order_by_asc_on_nullable_boolean_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Complete asc").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - } - - public class When_using_order_by_desc_on_nullable_boolean_with_one_criteria : SqlPagingAndOrdering - { - private Because of = () => nullableResult = testDb.NullableCollection.LinqToQuerystring("?$orderby=Complete desc").ToList(); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_first_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_third = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - } - - #endregion - - #region OrderBy Multiple Properties - - public class When_using_order_by_on_two_properties : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete,Age").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_on_one_descending_and_one_ascending : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc,Age").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_on_one_ascending_and_one_descending : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete,Age desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_on_two_properties_both_descending : SqlPagingAndOrdering - { - private Because of = () => result = testDb.ConcreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc,Age desc").ToList(); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - #endregion - - #region OrderBy SubProperties - - public class When_using_order_by_on_a_single_subproperty : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring(@"?$orderby=Concrete/Age").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_asc_on_a_single_subproperty : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring(@"?$orderby=Concrete/Age asc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_desc_on_a_single_subproperty : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Age desc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - #endregion - - #region OrderBy Multiple SubProperties - - public class When_using_order_by_on_two_sub_properties : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Concrete/Age").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_on_two_sub_properties_one_descending_and_one_ascending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Concrete/Age").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - } - - public class When_using_order_by_on_two_sub_properties_one_ascending_and_one_descending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Concrete/Age desc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_on_two_sub_properties_both_descending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Concrete/Age desc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - } - - #endregion - - #region OrderBy Mixed Properties and SubProperties - - public class When_using_order_by_on_mixed_properties : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Title").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_on_mixed_properties_one_descending_and_one_ascending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Title").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_second_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - } - - public class When_using_order_by_on_mixed_properties_one_ascending_and_one_descending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Title desc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - } - - public class When_using_order_by_on_mixed_properties_both_descending : SqlPagingAndOrdering - { - private Because of = () => complexResult = testDb.ComplexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Title desc").ToList(); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - } - - #endregion -} diff --git a/LinqToQueryString.IntegrationTests/SqlProjection.cs b/LinqToQueryString.IntegrationTests/SqlProjection.cs deleted file mode 100644 index 289675f..0000000 --- a/LinqToQueryString.IntegrationTests/SqlProjection.cs +++ /dev/null @@ -1,229 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class SqlProjection - { - protected static TestDbContext testDb; - - protected static List> result; - - protected static List concreteCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - testDb = new TestDbContext(); - - testDb.Database.ExecuteSqlCommand("UPDATE ComplexClasses SET Concrete_Id = NULL"); - testDb.Database.ExecuteSqlCommand("DELETE FROM EdgeCaseClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ConcreteClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM ComplexClasses"); - testDb.Database.ExecuteSqlCommand("DELETE FROM NullableClasses"); - - testDb.ComplexCollection.Add(new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }); - testDb.ComplexCollection.Add(new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) }); - - testDb.NullableCollection.Add(InstanceBuilders.BuildNull()); - testDb.NullableCollection.Add(InstanceBuilders.BuildNull(1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, guidArray[0])); - - testDb.SaveChanges(); - - concreteCollection = testDb.ConcreteCollection.ToList(); - nullableCollection = testDb.NullableCollection.ToList(); - - testDb = new TestDbContext(); - }; - } - - #region Single Property Tests - - public class When_selecting_a_single_string_property : SqlProjection - { - private Because of = - () => - result = testDb.ConcreteCollection.LinqToQuerystring>>("?$select=Name").ToList(); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo(r => r.ContainsKey("Name")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_selecting_a_single_int_property : SqlProjection - { - private Because of = - () => - result = testDb.ConcreteCollection.LinqToQuerystring>>("?$select=Age").ToList(); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Age")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - } - - public class When_selecting_a_single_datetime_property : SqlProjection - { - private Because of = - () => - result = testDb.ConcreteCollection.LinqToQuerystring>>("?$select=Date").ToList(); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Date")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Date"].ShouldEqual(concreteCollection.ElementAt(0).Date); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Date"].ShouldEqual(concreteCollection.ElementAt(1).Date); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Date"].ShouldEqual(concreteCollection.ElementAt(2).Date); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Date"].ShouldEqual(concreteCollection.ElementAt(3).Date); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Date"].ShouldEqual(concreteCollection.ElementAt(4).Date); - } - - public class When_selecting_a_single_boolean_property : SqlProjection - { - private Because of = - () => - result = testDb.ConcreteCollection.LinqToQuerystring>>("?$select=Complete").ToList(); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Complete")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Complete"].ShouldEqual(concreteCollection.ElementAt(0).Complete); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Complete"].ShouldEqual(concreteCollection.ElementAt(1).Complete); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Complete"].ShouldEqual(concreteCollection.ElementAt(2).Complete); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Complete"].ShouldEqual(concreteCollection.ElementAt(3).Complete); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Complete"].ShouldEqual(concreteCollection.ElementAt(4).Complete); - } - - public class When_selecting_multiple_properties : SqlProjection - { - private Because of = - () => - result = testDb.ConcreteCollection.LinqToQuerystring>>("?$select=Name,Age").ToList(); - - private It should_project_the_name_and_age_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Name") && r.ContainsKey("Age")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 2); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_project_the_right_name_for_the_first_record = () => result.ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_project_the_right_name_for_the_second_record = () => result.ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_project_the_right_name_for_the_third_record = () => result.ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_project_the_right_name_for_the_fourth_record = () => result.ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It sshould_project_the_right_name_for_the_fifth_record = () => result.ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - - private It should_project_the_right_age_for_the_first_record = () => result.ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_project_the_right_age_for_the_second_record = () => result.ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_project_the_right_age_for_the_third_record = () => result.ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_project_the_right_age_for_the_fourth_record = () => result.ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_project_the_right_age_for_the_fifth_record = () => result.ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_selecting_a_nullable_int_property : SqlProjection - { - private Because of = - () => - result = testDb.NullableCollection.LinqToQuerystring>>("?$select=Age").ToList(); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Age")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_2_results = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Age"].ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_then_return_the_second_record = () => result.ElementAt(1)["Age"].ShouldEqual(nullableCollection.ElementAt(1).Age); - } - - #endregion - - #region Complex Property Tests - - - - #endregion - - #region SubProperty Tests - - - - #endregion -} diff --git a/LinqToQueryString.IntegrationTests/TestDbContext.cs b/LinqToQueryString.IntegrationTests/TestDbContext.cs deleted file mode 100644 index 9f9fc81..0000000 --- a/LinqToQueryString.IntegrationTests/TestDbContext.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace LinqToQueryString.IntegrationTests.Sql -{ - using System.Data.Entity; - - using LinqToQueryString.Tests; - - public class TestDbContext : DbContext - { - public DbSet ConcreteCollection { get; set; } - - public DbSet ComplexCollection { get; set; } - - public DbSet EdgeCaseCollection { get; set; } - - public DbSet NullableCollection { get; set; } - - public DbSet NullableContainers { get; set; } - } -} diff --git a/LinqToQueryString.IntegrationTests/packages.config b/LinqToQueryString.IntegrationTests/packages.config deleted file mode 100644 index 7514d21..0000000 --- a/LinqToQueryString.IntegrationTests/packages.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/LinqToQueryString.Tests/ComplexClass.cs b/LinqToQueryString.Tests/ComplexClass.cs deleted file mode 100644 index 64bd261..0000000 --- a/LinqToQueryString.Tests/ComplexClass.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace LinqToQueryString.Tests -{ - using System.Collections.Generic; - - public class ComplexClass - { - public int Id { get; set; } - - public ConcreteClass Concrete { get; set; } - - public List StringCollection { get; set; } - - public List ConcreteCollection { get; set; } - - public string Title { get; set; } - - public List IntCollection { get; set; } - } - - public class ComplexClassDto - { - public int Id { get; set; } - - public ConcreteClass Concrete { get; set; } - - public IEnumerable StringCollection { get; set; } - - public List ConcreteCollection { get; set; } - - public string Title { get; set; } - - public IEnumerable IntCollection { get; set; } - } - - public class NullableClassDto - { - public IEnumerable NullableCollection { get; set; } - } -} diff --git a/LinqToQueryString.Tests/ConcreteClass.cs b/LinqToQueryString.Tests/ConcreteClass.cs deleted file mode 100644 index 89b7bb9..0000000 --- a/LinqToQueryString.Tests/ConcreteClass.cs +++ /dev/null @@ -1,106 +0,0 @@ -namespace LinqToQueryString.Tests -{ - using System; - using System.Collections.Generic; - - public class ConcreteClass : IComparable - { - public ConcreteClass() - { - Date = DateTime.UtcNow; - } - - public int Id { get; set; } - - public string Name { get; set; } - - public DateTime Date { get; set; } - - public bool Complete { get; set; } - - public int Age { get; set; } - - public List Children { get; set; } - - public IEnumerable StringCollection { get; set; } - - public long Population { get; set; } - - public double Value { get; set; } - - public float Cost { get; set; } - - public byte Code { get; set; } - - public Guid Guid { get; set; } - - public decimal Score { get; set; } - - public int CompareTo(ConcreteClass other) - { - return String.CompareOrdinal(this.Name, other.Name); - } - } - - public class EdgeCaseClass : IComparable - { - public EdgeCaseClass() - { - Date = DateTime.UtcNow; - } - - public int Id { get; set; } - - public string Name { get; set; } - - public DateTime Date { get; set; } - - public bool Complete { get; set; } - - public int Age { get; set; } - - public int CompareTo(EdgeCaseClass other) - { - return String.CompareOrdinal(this.Name, other.Name); - } - } - - public class NullableContainer - { - public int Id { get; set; } - - public string Name { get; set; } - - public List Nullables { get; set; } - } - - public class NullableValue - { - public int Id { get; set; } - - public int? Age { get; set; } - } - - public class NullableClass - { - public int? Id { get; set; } - - public DateTime? Date { get; set; } - - public int? Age { get; set; } - - public bool? Complete { get; set; } - - public long? Population { get; set; } - - public double? Value { get; set; } - - public float? Cost { get; set; } - - public byte? Code { get; set; } - - public Guid? Guid { get; set; } - - public List NullableInts { get; set; } - } -} diff --git a/LinqToQueryString.Tests/IndexedClass.cs b/LinqToQueryString.Tests/IndexedClass.cs deleted file mode 100644 index 6e4771d..0000000 --- a/LinqToQueryString.Tests/IndexedClass.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace LinqToQueryString.Tests -{ - using System.Collections.Generic; - - public class IndexedClass - { - private readonly Dictionary dictionary; - - public IndexedClass(Dictionary dictionary) - { - this.dictionary = dictionary; - } - - public object this[string index] - { - get - { - return this.dictionary[index]; - } - set - { - this.dictionary[index] = value; - } - } - } -} diff --git a/LinqToQueryString.Tests/InstanceBuilders.cs b/LinqToQueryString.Tests/InstanceBuilders.cs deleted file mode 100644 index 2ea90c9..0000000 --- a/LinqToQueryString.Tests/InstanceBuilders.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace LinqToQueryString.Tests -{ - using System; - - public static class InstanceBuilders - { - public static ConcreteClass BuildConcrete(string name, int age, DateTime date, bool complete) - { - return new ConcreteClass { Name = name, Date = date, Age = age, Complete = complete }; - } - - public static EdgeCaseClass BuildEdgeCase(string name, int age, DateTime date, bool complete) - { - return new EdgeCaseClass { Name = name, Date = date, Age = age, Complete = complete }; - } - - public static ConcreteClass BuildConcrete(string name, int age, DateTime date, bool complete, long population, double value, float cost, byte code, decimal score, Guid guid) - { - return new ConcreteClass { Name = name, Date = date, Age = age, Complete = complete, Population = population, Value = value, Cost = cost, Code = code, Score = score, Guid = guid }; - } - - public static NullableClass BuildNull() - { - return new NullableClass(); - } - - public static NullableClass BuildNull(int? age, DateTime? date, bool? complete, long? population, double? value, float? cost, byte? code, Guid? guid) - { - return new NullableClass { Date = date, Age = age, Complete = complete, Population = population, Value = value, Cost = cost, Code = code, Guid = guid }; - } - } -} \ No newline at end of file diff --git a/LinqToQueryString.Tests/LinqToQueryString.Tests.csproj b/LinqToQueryString.Tests/LinqToQueryString.Tests.csproj deleted file mode 100644 index 761a599..0000000 --- a/LinqToQueryString.Tests/LinqToQueryString.Tests.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - - Debug - AnyCPU - {139B0E4C-BC18-4180-8863-FB248CFDA42E} - Library - Properties - LinqToQueryString.Tests - LinqToQueryString.Tests - v3.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\Machine.Specifications.0.7.0-Unstable0077\lib\net20\Machine.Specifications.dll - - - ..\packages\Machine.Specifications.Should.0.7.0-Unstable0008\lib\net20\Machine.Specifications.Should.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - - - False - - - False - - - False - - - - - - - - \ No newline at end of file diff --git a/LinqToQueryString.Tests/Properties/AssemblyInfo.cs b/LinqToQueryString.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index ad783cf..0000000 --- a/LinqToQueryString.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LinqToQueryString.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LinqToQueryString.Tests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("099dce67-e299-4269-94a8-56cc7194af8e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinqToQueryString.Tests/RandomDataGenerators.cs b/LinqToQueryString.Tests/RandomDataGenerators.cs deleted file mode 100644 index b0b2f04..0000000 --- a/LinqToQueryString.Tests/RandomDataGenerators.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace LinqToQueryString.Tests -{ - using System; - - public static class RandomDataGenerators - { - private static readonly Random Random = new Random(); - - public static string String() - { - return Guid.NewGuid().ToString(); - } - - public static int Int(int min, int max) - { - return Random.Next(min, max); - } - - public static long Long() - { - return Random.Next(10000, 999999); - } - - public static long Long(int min, int max) - { - return Random.Next(min, max); - } - - public static Guid NewGuid() - { - return Guid.NewGuid(); - } - - public static DateTime DateAndTime() - { - var start = new DateTime(1995, 1, 1); - var range = (int)(DateTime.Today - start).TotalDays; - return start.AddDays(Random.Next(range)); - } - - public static bool Bool() - { - return Random.Next(0, 1) > 0; - } - } -} diff --git a/LinqToQueryString.UnitTests/CollectionAggregates.cs b/LinqToQueryString.UnitTests/CollectionAggregates.cs deleted file mode 100644 index 30098f5..0000000 --- a/LinqToQueryString.UnitTests/CollectionAggregates.cs +++ /dev/null @@ -1,352 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class CollectionAggregates - { - protected static Exception ex; - - protected static IQueryable result; - - protected static IQueryable nullableResult; - - protected static List complexCollection; - - protected static List nullableCollection; - - private Establish context = () => - { - complexCollection = new List - { - new ComplexClass - { - Title = "Charles", StringCollection = new List { "Apple" }, - IntCollection = new List { 1 }, - Concrete = new ConcreteClass { StringCollection = new List { "Apple", "Banana" } }, - ConcreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) - } - }, - new ComplexClass - { - Title = "Andrew", StringCollection = new List { "Apple", "Banana" }, - IntCollection = new List { 1, 2 }, - Concrete = new ConcreteClass { StringCollection = new List { "Apple", "Banana", "Custard" } }, - ConcreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) - } - }, - new ComplexClass - { - Title = "David", StringCollection = new List { "Apple", "Banana", "Custard" }, - IntCollection = new List { 1, 2, 3 }, - Concrete = new ConcreteClass { StringCollection = new List { "Apple", "Custard", "Dogfood", "Eggs" } }, - ConcreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false), - InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) - } - }, - new ComplexClass - { - Title = "Edward", StringCollection = new List { "Apple", "Custard", "Dogfood", "Eggs" }, - IntCollection = new List { 1, 3, 4, 5 }, - Concrete = new ConcreteClass { StringCollection = new List { "Apple", "Dogfood", "Eggs" } }, - ConcreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false), - InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) - } - }, - new ComplexClass - { - Title = "Boris", StringCollection = new List { "Apple", "Dogfood", "Eggs" }, - IntCollection = new List { 1, 4, 5 }, - Concrete = new ConcreteClass { StringCollection = new List { "Apple" } }, - ConcreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false), - InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) - } - } - }; - - nullableCollection = new List - { - new NullableClass { NullableInts = new List { null } }, - new NullableClass { NullableInts = new List { 1 } }, - new NullableClass { NullableInts = new List { 1, 2 } }, - new NullableClass { NullableInts = new List { null, 1, 2 } }, - }; - }; - } - - #region Int Collections - - public class When_filtering_on_a_simple_collection_property_using_max_against_an_int : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=IntCollection/max() eq 5"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_is_5 = () => result.ShouldEachConformTo(o => o.IntCollection.Max() == 5); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_an_int : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=IntCollection/min() eq 1"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_min_value_is_1 = () => result.ShouldEachConformTo(o => o.IntCollection.Min() == 1); - } - - public class When_filtering_on_a_simple_collection_property_using_sum_against_an_int : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=IntCollection/sum() gt 6"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_sum_of_values_is_greater_than_6 = () => result.ShouldEachConformTo(o => o.IntCollection.Sum() > 6); - } - - public class When_filtering_on_a_simple_collection_property_using_average_against_an_int : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=IntCollection/average() ge 2"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_average_of_values_is_greater_than_or_equal_to_2 = () => result.ShouldEachConformTo(o => o.IntCollection.Average() >= 2); - } - - #endregion - - #region Nullable Int Collections - - public class When_filtering_on_a_simple_collection_property_using_max_against_a_nullable_int : CollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("$filter=NullableInts/max() eq 2"); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_is_2 = () => nullableResult.ShouldEachConformTo(o => o.NullableInts.Max() == 2); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_a_nullable_int : CollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("$filter=NullableInts/min() eq 1"); - - private It should_return_three_records = () => nullableResult.Count().ShouldEqual(3); - - private It should_only_return_records_where_min_value_is_1 = () => nullableResult.ShouldEachConformTo(o => o.NullableInts.Min() == 1); - } - - public class When_filtering_on_a_simple_collection_property_using_sum_against_a_nullable_int : CollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("$filter=NullableInts/sum() gt 2"); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_sum_of_values_is_greater_than_2 = () => nullableResult.ShouldEachConformTo(o => o.NullableInts.Sum() > 2); - } - - public class When_filtering_on_a_simple_collection_property_using_average_against_a_nullable_int : CollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("$filter=NullableInts/average() ge 1"); - - private It should_return_three_records = () => nullableResult.Count().ShouldEqual(3); - - private It should_only_return_records_where_average_of_values_is_greater_than_or_equal_to_1 = () => nullableResult.ShouldEachConformTo(o => o.NullableInts.Average() >= 1); - } - - public class When_filtering_on_a_nullable_int_collection_property_using_any_checking_for_nulls : CollectionAggregates - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("$filter=NullableInts/any(int: int eq null)"); - - private It should_return_two_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_banana = () => nullableResult.ShouldEachConformTo(o => o.NullableInts.Any(s => s == null)); - } - - #endregion - - #region String collections - - public class When_filtering_on_a_simple_collection_property_using_any : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/any(tag: tag eq 'Banana')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_banana = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s == "Banana")); - } - - public class When_filtering_on_a_simple_collection_property_using_any_with_an_or : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/any(tag: tag eq 'Banana' or tag eq 'Eggs')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_string_collection_contains_banana_or_eggs = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s == "Banana" || s == "Eggs")); - } - - public class When_filtering_on_a_simple_collection_property_using_any_with_functions : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/any(tag: startswith(tag,'Dog'))"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_string_collection_contains_value_starting_with_dog = () => result.ShouldEachConformTo(o => o.StringCollection.Any(s => s.StartsWith("Dog"))); - } - - public class When_filtering_on_a_simple_collection_property_using_all : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/all(tag: tag eq 'Apple')"); - - private It should_return_one_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_string_collection_records_are_apple = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s == "Apple")); - } - - public class When_filtering_on_a_simple_collection_property_using_all_with_an_or : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/all(tag: tag eq 'Apple' or tag eq 'Banana')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_all_string_collection_records_are_apple_or_banana = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s == "Apple" || s == "Banana")); - } - - public class When_filtering_on_a_simple_collection_property_using_all_with_functions : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/all(tag: startswith(tag,'App'))"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_string_collection_records_start_with_app = () => result.ShouldEachConformTo(o => o.StringCollection.All(s => s.StartsWith("App"))); - } - - public class When_filtering_on_a_simple_collection_property_using_count : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/count() ge 3"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_string_collection_count_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.StringCollection.Count() >= 3); - } - - public class When_filtering_on_a_simple_collection_property_using_max_against_a_string : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/max() eq 'Eggs'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_max_value_of_string_collection_is_eggs = () => result.ShouldEachConformTo(o => o.StringCollection.Max() == "Eggs"); - } - - public class When_filtering_on_a_simple_collection_property_using_min_against_a_string : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=StringCollection/min() eq 'Apple'"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_min_value_of_string_collection_is_apple = () => result.ShouldEachConformTo(o => o.StringCollection.Min() == "Apple"); - } - - #endregion - - #region Complex collections - - public class When_filtering_on_a_complex_collection_property_using_any : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/any(concrete: concrete/Name eq 'Banana')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_banana = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name == "Banana")); - } - - public class When_filtering_on_a_complex_collection_property_using_any_with_an_or : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/any(concrete: concrete/Name eq 'Banana' or concrete/Name eq 'Eggs')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_banana_or_eggs = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name == "Banana" || s.Name == "Eggs")); - } - - public class When_filtering_on_a_complex_collection_property_using_any_with_functions : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/any(concrete: startswith(concrete/Name,'Dog'))"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_collection_contains_value_with_name_starting_with_dog = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Any(s => s.Name.StartsWith("Dog"))); - } - - public class When_filtering_on_a_complex_collection_property_using_all : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/all(concrete: concrete/Name eq 'Apple')"); - - private It should_return_one_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_apple = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name == "Apple")); - } - - public class When_filtering_on_a_complex_collection_property_using_all_with_an_or : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/all(concrete: concrete/Name eq 'Apple' or concrete/Name eq 'Banana')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_apple_or_banana = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name == "Apple" || s.Name == "Banana")); - } - - public class When_filtering_on_a_complex_collection_property_using_all_with_functions : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/all(concrete: startswith(concrete/Name,'App'))"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_all_concrete_collection_values_have_name_starting_with_app = () => result.ShouldEachConformTo(o => o.ConcreteCollection.All(s => s.Name.StartsWith("App"))); - } - - public class When_filtering_on_a_complex_collection_property_using_count : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=ConcreteCollection/count() ge 3"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_concrete_collection_count_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.ConcreteCollection.Count() >= 3); - } - - #endregion - - #region Nested Simple collections - - public class When_filtering_on_a_nested_simple_collection_property_using_any : CollectionAggregates - { - private Because of = () => result = complexCollection.AsQueryable().LinqToQuerystring("$filter=Concrete/StringCollection/any(string: string eq 'Banana')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_concrete_stringcollection_contains_banana = () => result.ShouldEachConformTo(o => o.Concrete.StringCollection.Any(s => s == "Banana")); - } - - #endregion -} diff --git a/LinqToQueryString.UnitTests/Dynamics.cs b/LinqToQueryString.UnitTests/Dynamics.cs deleted file mode 100644 index 52bab86..0000000 --- a/LinqToQueryString.UnitTests/Dynamics.cs +++ /dev/null @@ -1,156 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class Dynamics - { - protected static List> collection; - - protected static IQueryable> result; - - private Establish context = () => - { - var item1 = new Dictionary(); - item1["Age"] = 23; - item1["Name"] = "Karl"; - item1["Score"] = 0.1m; - - var item2 = new Dictionary(); - item2["Age"] = 25; - item2["Name"] = "Kathryn"; - item2["Score"] = 0.2m; - - var item3 = new Dictionary(); - item3["Age"] = 28; - item3["Name"] = "Pete"; - item3["Score"] = 0.3m; - - var item4 = new Dictionary(); - item4["Age"] = 17; - item4["Name"] = "Dominic"; - item4["Score"] = 0.4m; - - collection = new List> { item1, item2, item3, item4 }; - }; - } - - public class When_using_not_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=not [Age] eq 25"); - - private It should_return_three_results = () => result.Count().ShouldEqual(3); - } - - public class When_using_ge_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Age] ge 25"); - - private It should_return_two_results = () => result.Count().ShouldEqual(2); - } - - public class When_using_eq_filter_on_a_dynamic_type_decimal_property : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Score] eq 0.4m"); - - private It should_return_one_result = () => result.Count().ShouldEqual(1); - } - - public class When_using_ge_filter_on_a_dynamic_type_decimal_property : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Score] ge 1.0m"); - - private It should_return_one_result = () => result.Count().ShouldEqual(0); - } - - public class When_using_gt_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Age] gt 25"); - - private It should_return_two_results = () => result.Count().ShouldEqual(1); - } - - public class When_using_le_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Age] le 25"); - - private It should_return_two_results = () => result.Count().ShouldEqual(3); - } - - public class When_using_lt_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Age] lt 25"); - - private It should_return_two_results = () => result.Count().ShouldEqual(2); - } - - public class When_using_eq_filter_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=[Age] eq 25"); - - private It should_return_two_results = () => result.Count().ShouldEqual(1); - } - - public class When_using_eq_filter_on_a_dynamic_type_with_reversed_parameters : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=25 eq [Age]"); - - private It should_return_two_results = () => result.Count().ShouldEqual(1); - } - - public class When_using_order_by_on_a_dynamic_type : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$orderby=[Age]"); - - private It should_return_two_results = () => result.Count().ShouldEqual(4); - } - - public class When_filtering_using_startswith_function_on_a_dynamic_type : Dynamics - { - private Because of = - () => result = collection.AsQueryable().LinqToQuerystring("?$filter=startswith([Name],'Ka')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_starts_with_Sat = - () => result.ShouldEachConformTo(o => ((string)o["Name"]).StartsWith("Ka")); - } - - public class When_filtering_using_endswith_function_on_a_dynamic_type : Dynamics - { - private Because of = - () => result = collection.AsQueryable().LinqToQuerystring("?$filter=endswith([Name],'te')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_ends_with_day = - () => result.ShouldEachConformTo(o => ((string)o["Name"]).EndsWith("te")); - } - - public class When_filtering_using_substringof_function_on_a_dynamic_type : Dynamics - { - private Because of = - () => result = collection.AsQueryable().LinqToQuerystring("?$filter=substringof('r',[Name])"); - - private It should_return_three_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => ((string)o["Name"]).Contains("r")); - } - - public class When_filtering_using_tolower_function_on_a_dynamic_type : Dynamics - { - private Because of = - () => result = collection.AsQueryable().LinqToQuerystring("?$filter=tolower([Name] eq 'pete')"); - - private It should_return_three_records = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => ((string)o["Name"]).ToLower() == "pete"); - } -} diff --git a/LinqToQueryString.UnitTests/Exceptions.cs b/LinqToQueryString.UnitTests/Exceptions.cs deleted file mode 100644 index 604a3d1..0000000 --- a/LinqToQueryString.UnitTests/Exceptions.cs +++ /dev/null @@ -1,171 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Linq; - - using LinqToQuerystring; - using LinqToQuerystring.Exceptions; - - using Machine.Specifications; - - public class When_using_eq_filter_on_a_dynamic_type_decimal_property_without_m_suffix : Dynamics - { - private static Exception ex; - - private Because of = () => ex = Catch.Exception(() => collection.AsQueryable().LinqToQuerystring("$filter=[Score] eq 0.4").ToList()); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - #region Filter on String tests - - public class When_using_eq_filter_on_a_single_with_an_invalid_escape_sequence : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\Bob'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_gt_filter_on_a_single_string : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name gt 'B'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_ge_filter_on_a_single_string : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name ge 'B'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_lt_filter_on_a_single_string : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name lt 'B'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_le_filter_on_a_single_string : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name lt 'B'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - #endregion - - #region Filter on Bool tests - - public class When_using_gt_filter_on_a_single_bool : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete gt false")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_ge_filter_on_a_single_bool : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete ge datetime'2003-01-01T00:00'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_lt_filter_on_a_single_bool : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete lt datetime'2003-01-01T00:00'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - public class When_using_le_filter_on_a_single_bool : Filtering - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete le datetime'2003-01-01T00:00'")); - - private It should_throw_an_exception = () => ex.ShouldBeOfType(); - } - - #endregion - - #region Filter on DateTime & DateTimeOffset tests - - public class When_using_year_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=year(Name) eq 2005")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_years_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=years(Name) eq 2002")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_month_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=month(Name) eq 5")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_day_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=day(Name) eq 4")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_days_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=days(Name) eq 2")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_hour_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=hour(Name) eq 9")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_hours_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=hours(Name) eq 14")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_minute_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=minute(Name) eq 5")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_minutes_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=minutes(Name) eq 45")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_second_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=second(Name) eq 23")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - public class When_using_seconds_function_on_a_string : Functions - { - private Because of = () => ex = Catch.Exception(() => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=seconds(Name) eq 32")); - - private It should_throw_an_exception = () => ex.ShouldBeOfExactType(); - } - - #endregion -} diff --git a/LinqToQueryString.UnitTests/Filtering.cs b/LinqToQueryString.UnitTests/Filtering.cs deleted file mode 100644 index e819b0d..0000000 --- a/LinqToQueryString.UnitTests/Filtering.cs +++ /dev/null @@ -1,1683 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class Filtering - { - protected static Exception ex; - - protected static IQueryable result; - - protected static IQueryable complexResult; - - protected static IQueryable nullableResult; - - protected static List concreteCollection; - - protected static List complexCollection; - - protected static List edgeCaseCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - concreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, 0.1m, guidArray[0]), - InstanceBuilders.BuildConcrete("Apple", 2, new DateTime(2005, 01, 01), false, 30000000000, 333.333, 333.333f, 0x22, 0.3m, guidArray[2]), - InstanceBuilders.BuildConcrete("Custard", 1, new DateTime(2003, 01, 01), true, 50000000000, 555.555, 555.555f, 0xDD, 0.5m, guidArray[4]), - InstanceBuilders.BuildConcrete("Custard", 2, new DateTime(2002, 01, 01), false, 30000000000, 333.333, 333.333f, 0x00, 0.3m, guidArray[2]), - InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2002, 01, 01), true, 40000000000, 444.444, 444.444f, 0x22, 0.4m, guidArray[3]), - InstanceBuilders.BuildConcrete("Banana", 3, new DateTime(2003, 01, 01), false, 10000000000, 111.111, 111.111f, 0x00, 0.1m, guidArray[0]), - InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2005, 01, 01), true, 40000000000, 444.444, 444.444f, 0xCC, 0.4m, guidArray[3]), - InstanceBuilders.BuildConcrete("Eggs", 3, new DateTime(2001, 01, 01), false, 20000000000, 222.222, 222.222f, 0xCC, 0.2m, guidArray[1]), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2003, 01, 01), true, 30000000000, 333.333, 333.333f, 0xEE, 0.3m, guidArray[2]), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2004, 01, 01), false, 10000000000, 111.111, 111.111f, 0xDD, 0.1m, guidArray[0]), - InstanceBuilders.BuildConcrete("Dogfood", 5, new DateTime(2001, 01, 01), true, 20000000000, 222.222, 222.222f, 0xCC, 0.2m, guidArray[1]) - }; - - edgeCaseCollection = new List - { - InstanceBuilders.BuildConcrete("Apple\\Bob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\bBob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\tBob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\nBob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\fBob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\rBob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("Apple\"Bob", 1, new DateTime(2002 , 01, 01), true), - InstanceBuilders.BuildConcrete("Apple'Bob", 1, new DateTime(2002, 01, 01), true), - InstanceBuilders.BuildConcrete("x y & z", 1, new DateTime(2002, 01, 01), true), - }; - - complexCollection = new List - { - new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }, - new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }, - new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }, - new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }, - new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) } - }; - - nullableCollection = new List - { - InstanceBuilders.BuildNull(), - InstanceBuilders.BuildNull(1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, guidArray[0]) - }; - }; - } - - #region Ignored operators - - public class When_using_eq_filter_on_a_single_with_a_leading_superflouous_operator : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$format=json&$filter=Name eq 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_with_a_trailing_superflouous_operator : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple'&$format=json"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_with_a_leading_superflouous_query_parameter : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?format=json&$filter=Name eq 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_with_a_trailing_superflouous_query_parameter : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple'&format=json"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - #endregion - - #region Filter on implicit boolean identifiers - - public class When_specifying_a_single_boolean_identifier_as_a_filter : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Complete); - } - - public class When_specifying_a_negated_single_boolean_identifier_as_a_filter : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => !o.Complete); - } - - #endregion - - #region Filter on string tests - - public class When_using_eq_filter_on_a_single_string : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_string_and_applying_top : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple'&$top=1"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_eq_filter_on_a_single_string_with_reversed_parameters : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter='Apple' eq Name"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - public class When_using_not_eq_filter_on_a_single_string : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Name eq 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_name_is_not_apple = () => result.ShouldEachConformTo(o => o.Name != "Apple"); - } - - public class When_using_ne_filter_on_a_single_string : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name ne 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_name_is_not_apple = () => result.ShouldEachConformTo(o => o.Name != "Apple"); - } - - public class When_using_not_ne_filter_on_a_single_string : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Name ne 'Apple'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_is_apple = () => result.ShouldEachConformTo(o => o.Name == "Apple"); - } - - #endregion - - #region Filter on string escape character tests - - public class When_using_eq_filter_on_a_single_string_with_escaped_slash : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\\Bob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\\Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_backspace : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\bBob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\bBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_tab : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\tBob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\tBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_newline : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\nBob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\nBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_formfeed : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\fBob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\fBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_carriage_return : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\rBob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple\rBob"); - } - - public class When_using_eq_filter_on_a_single_string_with_quote : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple""Bob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == @"Apple""Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_double_escaped_single_quote : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple''Bob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple'Bob"); - } - - public class When_using_eq_filter_on_a_single_string_with_escaped_single_quote : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'Apple\'Bob'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "Apple'Bob"); - } - - #endregion - - #region Filter on url encoded character tests - - public class When_using_eq_filter_with_url_encoding : Filtering - { - private Because of = () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=Name eq 'x%20y%20%26%20z'"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_matches = () => result.ShouldEachConformTo(o => o.Name == "x y & z"); - } - - #endregion - - #region Filter on int tests - - public class When_using_eq_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age eq 4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age == 4); - } - - public class When_using_eq_filter_on_a_negative_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age gt -4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age > -4); - } - - public class When_using_not_eq_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age eq 4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_age_is_not_4 = () => result.ShouldEachConformTo(o => o.Age != 4); - } - - public class When_using_ne_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age ne 4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_age_is_not_4 = () => result.ShouldEachConformTo(o => o.Age != 4); - } - - public class When_using_not_ne_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age ne 4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age == 4); - } - - public class When_using_gt_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age gt 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.Age > 3); - } - - public class When_using_not_gt_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age gt 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_greater_than_3 = () => result.ShouldEachConformTo(o => !(o.Age > 3)); - } - - public class When_using_ge_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age ge 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Age >= 3); - } - - public class When_using_not_ge_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age ge 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Age >= 3)); - } - - public class When_using_lt_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age lt 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_less_than_3 = () => result.ShouldEachConformTo(o => o.Age < 3); - } - - public class When_using_not_lt_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age lt 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_not_less_than_3 = () => result.ShouldEachConformTo(o => !(o.Age < 3)); - } - - public class When_using_le_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Age le 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Age <= 3); - } - - public class When_using_not_le_filter_on_a_single_int : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Age le 3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_not_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Age <= 3)); - } - - #endregion - - #region Filter on long tests - - public class When_using_eq_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population eq 40000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_population_is_40000000000 = () => result.ShouldEachConformTo(o => o.Population == 40000000000); - } - - public class When_using_eq_filter_on_a_negative_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population gt -40000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Age > -40000000000); - } - - public class When_using_not_eq_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population eq 40000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_population_is_not_40000000000 = () => result.ShouldEachConformTo(o => o.Population != 40000000000); - } - - public class When_using_ne_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population ne 40000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_population_is_not_40000000000 = () => result.ShouldEachConformTo(o => o.Population != 40000000000); - } - - public class When_using_not_ne_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population ne 40000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_population_is_40000000000 = () => result.ShouldEachConformTo(o => o.Population == 40000000000); - } - - public class When_using_gt_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population gt 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_population_is_greater_than_30000000000 = () => result.ShouldEachConformTo(o => o.Population > 30000000000); - } - - public class When_using_not_gt_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population gt 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_population_is_not_greater_than_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population > 30000000000)); - } - - public class When_using_ge_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population ge 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_population_is_greater_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => o.Population >= 30000000000); - } - - public class When_using_not_ge_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population ge 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_population_is_not_greater_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population >= 30000000000)); - } - - public class When_using_lt_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population lt 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_population_is_less_than_30000000000 = () => result.ShouldEachConformTo(o => o.Population < 30000000000); - } - - public class When_using_not_lt_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population lt 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_population_is_not_less_than_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population < 30000000000)); - } - - public class When_using_le_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Population le 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_population_is_less_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => o.Population <= 30000000000); - } - - public class When_using_not_le_filter_on_a_single_long : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Population le 30000000000L"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_population_is_not_less_than_or_equal_to_30000000000 = () => result.ShouldEachConformTo(o => !(o.Population <= 0000000000)); - } - - #endregion - - #region Filter on byte tests - - public class When_using_eq_filter_on_a_single_byte_numerically : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code eq 34"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_eq_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code eq 0x22"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_not_eq_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code eq 0x22"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_code_is_not_0x22 = () => result.ShouldEachConformTo(o => o.Code != 0x22); - } - - public class When_using_ne_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code ne 0x22"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_code_is_not_0x22 = () => result.ShouldEachConformTo(o => o.Code != 0x22); - } - - public class When_using_not_ne_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code ne 0x22"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_code_is_0x22 = () => result.ShouldEachConformTo(o => o.Code == 0x22); - } - - public class When_using_gt_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code gt 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_code_is_greater_than_0xCC = () => result.ShouldEachConformTo(o => o.Code > 0xCC); - } - - public class When_using_not_gt_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code gt 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_code_is_not_greater_than_0xCC = () => result.ShouldEachConformTo(o => !(o.Code > 0xCC)); - } - - public class When_using_ge_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code ge 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_code_is_greater_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => o.Code >= 0xCC); - } - - public class When_using_not_ge_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code ge 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_code_is_not_greater_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => !(o.Code >= 0xCC)); - } - - public class When_using_lt_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code lt 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_code_is_less_than_0xCC = () => result.ShouldEachConformTo(o => o.Code < 0xCC); - } - - public class When_using_not_lt_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code lt 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_code_is_not_less_than_0xCC = () => result.ShouldEachConformTo(o => !(o.Code < 0xCC)); - } - - public class When_using_le_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Code le 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_code_is_less_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => o.Code <= 0xCC); - } - - public class When_using_not_le_filter_on_a_single_byte : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Code le 0xCC"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_code_is_not_less_than_or_equal_to_0xCC = () => result.ShouldEachConformTo(o => !(o.Code <= 0000000000)); - } - - #endregion - - #region Filter on guid tests - - public class When_using_eq_filter_on_a_single_guid : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(string.Format("?$filter=Guid eq guid'{0}'", guidArray[1])); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid == guidArray[1]); - } - - public class When_using_not_eq_filter_on_a_single_guid : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(string.Format("?$filter=not Guid eq guid'{0}'", guidArray[1])); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid != guidArray[1]); - } - - public class When_using_ne_filter_on_a_single_guid : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(string.Format("?$filter=Guid ne guid'{0}'", guidArray[1])); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid != guidArray[1]); - } - - public class When_using_not_ne_filter_on_a_single_guid : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(string.Format("?$filter=not Guid ne guid'{0}'", guidArray[1])); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_guid_matches = () => result.ShouldEachConformTo(o => o.Guid == guidArray[1]); - } - - #endregion - - #region Filter on single tests - - public class When_using_eq_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost eq 444.444f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_cost_is_444point444 = () => result.ShouldEachConformTo(o => o.Cost == 444.444f); - } - - public class When_using_eq_filter_on_a_negative_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost gt -444.444f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Cost > -444.444f); - } - - public class When_using_not_eq_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost eq 444.444f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_cost_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Cost != 444.444f); - } - - public class When_using_ne_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost ne 444.444f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_cost_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Cost != 444.444f); - } - - public class When_using_not_ne_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost ne 444.444f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_cost_is_444point444 = () => result.ShouldEachConformTo(o => o.Cost == 444.444f); - } - - public class When_using_gt_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost gt 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_cost_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Cost > 333.333f); - } - - public class When_using_not_gt_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost gt 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_cost_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost > 333.333f)); - } - - public class When_using_ge_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost ge 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_cost_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Cost >= 333.333f); - } - - public class When_using_not_ge_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost ge 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_cost_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost >= 333.333f)); - } - - public class When_using_lt_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost lt 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_cost_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Cost < 333.333f); - } - - public class When_using_not_lt_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost lt 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_cost_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost < 333.333f)); - } - - public class When_using_le_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost le 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_cost_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Cost <= 333.333f); - } - - public class When_using_not_le_filter_on_a_single_single : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Cost le 333.333f"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_cost_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Cost <= 333.333f)); - } - - #endregion - - #region Filter on double tests - - public class When_using_eq_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value eq 444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Value == 444.444); - } - - public class When_using_eq_filter_on_a_negative_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Cost gt -444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Cost > -444.444); - } - - public class When_using_not_eq_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value eq 444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Value != 444.444); - } - - public class When_using_ne_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value ne 444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Value != 444.444); - } - - public class When_using_not_ne_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value ne 444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Value == 444.444); - } - - public class When_using_gt_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value gt 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Value > 333.333); - } - - public class When_using_not_gt_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value gt 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Value > 333.333)); - } - - public class When_using_ge_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value ge 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Value >= 333.333); - } - - public class When_using_ge_filter_on_a_double_using_d_suffix : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value ge 333d"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Value >= 333.333); - } - - public class When_using_not_ge_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value ge 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Value >= 333.333)); - } - - public class When_using_lt_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value lt 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Value < 333.333); - } - - public class When_using_not_lt_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value lt 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Value < 333.333)); - } - - public class When_using_le_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Value le 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Value <= 333.333); - } - - public class When_using_not_le_filter_on_a_single_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Value le 333.333"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Value <= 333.333)); - } - - #endregion - - #region Filter on decimal tests - - public class When_using_eq_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score eq 0.4m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_eq_filter_on_a_decimal_without_m_suffix : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score eq 0.4"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_eq_filter_on_a_decimal_and_a_double : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score eq 0.4m and Value eq 444.444"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_eq_filter_on_a_negative_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score gt -0.4m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(11); - - private It should_only_return_records_where_age_is_4 = () => result.ShouldEachConformTo(o => o.Score > -0.4m); - } - - public class When_using_not_eq_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score eq 0.4m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Score != 0.4m); - } - - public class When_using_ne_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score ne 0.4m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_where_value_is_not_444point444 = () => result.ShouldEachConformTo(o => o.Score != 0.4m); - } - - public class When_using_not_ne_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score ne 0.4m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_value_is_444point444 = () => result.ShouldEachConformTo(o => o.Score == 0.4m); - } - - public class When_using_gt_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score gt 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_greater_than_333point333 = () => result.ShouldEachConformTo(o => o.Score > 0.3m); - } - - public class When_using_not_gt_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score gt 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_not_greater_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Score > 0.3m)); - } - - public class When_using_ge_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score ge 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Score >= 0.3m); - } - - public class When_using_not_ge_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score ge 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_not_greater_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Score >= 0.3m)); - } - - public class When_using_lt_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score lt 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_value_is_less_than_333point333 = () => result.ShouldEachConformTo(o => o.Score < 0.3m); - } - - public class When_using_not_lt_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score lt 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_value_is_not_less_than_333point333 = () => result.ShouldEachConformTo(o => !(o.Score < 0.3m)); - } - - public class When_using_le_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Score le 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_value_is_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => o.Score <= 0.3m); - } - - public class When_using_not_le_filter_on_a_decimal : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Score le 0.3m"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_value_is_not_less_than_or_equal_to_333point333 = () => result.ShouldEachConformTo(o => !(o.Score <= 0.3m)); - } - - #endregion - - #region Filter on date tests - - public class When_using_eq_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date eq datetime'2002-01-01T00:00'"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_date_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_not_eq_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date eq datetime'2002-01-01T00:00'"); - - private It should_return_eight_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date != new DateTime(2002, 01, 01)); - } - - public class When_using_ne_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date ne datetime'2002-01-01T00:00'"); - - private It should_return_eight_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date != new DateTime(2002, 01, 01)); - } - - public class When_using_not_ne_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date ne datetime'2002-01-01T00:00'"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_gt_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date gt datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_greater_than_3 = () => result.ShouldEachConformTo(o => o.Date > new DateTime(2003, 01, 01)); - } - - public class When_using_not_gt_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date gt datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_not_greater_than_3 = () => result.ShouldEachConformTo(o => !(o.Date > new DateTime(2003, 01, 01))); - } - - public class When_using_ge_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date ge datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Date >= new DateTime(2003, 01, 01)); - } - - public class When_using_not_ge_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date ge datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_greater_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Date >= new DateTime(2003, 01, 01))); - } - - public class When_using_lt_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date lt datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_less_than_3 = () => result.ShouldEachConformTo(o => o.Date < new DateTime(2003, 01, 01)); - } - - public class When_using_not_lt_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date lt datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_not_less_than_3 = () => result.ShouldEachConformTo(o => !(o.Date < new DateTime(2003, 01, 01))); - } - - public class When_using_le_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Date le datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(8); - - private It should_only_return_records_where_age_is_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => o.Date <= new DateTime(2003, 01, 01)); - } - - public class When_using_not_le_filter_on_a_single_date : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Date le datetime'2003-01-01T00:00'"); - - private It should_return_two_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_age_is_not_less_than_or_equal_to_3 = () => result.ShouldEachConformTo(o => !(o.Date <= new DateTime(2003, 01, 01))); - } - - #endregion - - #region Filter on bool tests - - public class When_using_eq_filter_on_a_single_bool : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete eq true"); - - private It should_return_three_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_bool_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Complete); - } - - public class When_using_not_eq_filter_on_a_single_bool : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete eq true"); - - private It should_return_eight_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => !o.Complete); - } - - public class When_using_ne_filter_on_a_single_bool : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Complete ne true"); - - private It should_return_eight_records = () => result.Count().ShouldEqual(5); - - private It should_only_return_records_where_age_is_not_2002_01_01 = () => result.ShouldEachConformTo(o => !o.Complete); - } - - public class When_using_not_ne_filter_on_a_single_bool : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete ne true"); - - private It should_return_three_records = () => result.Count().ShouldEqual(6); - - private It should_only_return_records_where_age_is_2002_01_01 = () => result.ShouldEachConformTo(o => o.Complete); - } - - #endregion - - #region Filter on nullable ints - - //eq - public class When_using_eq_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age eq 1"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - public class When_using_eq_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=1 eq Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - //ne - public class When_using_ne_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age ne 1"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != 1); - } - - public class When_using_ne_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=1 ne Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != 1); - } - - //gt - public class When_using_gt_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age gt 0"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age > 0); - } - - public class When_using_gt_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=2 gt Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 2 > o.Age); - } - - //ge - public class When_using_ge_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age ge 1"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age >= 1); - } - - public class When_using_ge_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=1 ge Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 1 >= o.Age); - } - - //lt - public class When_using_lt_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age lt 2"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age < 2); - } - - public class When_using_lt_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=0 lt Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 0 < o.Age); - } - - //le - public class When_using_le_filter_on_a_single_nullable_int : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age le 1"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == 1); - } - - public class When_using_le_filter_on_a_single_nullable_int_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=1 le Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => 1 <= o.Age); - } - - //not - - #endregion - - #region Filter with comparison to nulls - - //eq - public class When_using_eq_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age eq null"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == null); - } - - public class When_using_eq_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null eq Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age == null); - } - - //ne - public class When_using_ne_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age ne null"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != null); - } - - public class When_using_ne_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null ne Age"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Age != null); - } - - //gt - public class When_using_gt_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age gt null"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_gt_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null gt Age"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //ge - public class When_using_ge_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age ge null"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_ge_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null ge Age"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //lt - public class When_using_lt_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age lt null"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_lt_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null lt Age"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //le - public class When_using_le_filter_null_comparison : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Age le null"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - public class When_using_le_filter_null_comparison_with_operands_reversed : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=null le Age"); - - private It should_return_0_records_because_null_is_not_valid_for_comparisons = () => nullableResult.Count().ShouldEqual(0); - } - - //not - - #endregion - - #region Filter on other nullable types - - public class When_using_eq_filter_on_a_single_nullable_date : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Date eq datetime'2002-01-01T00:00'"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Date == new DateTime(2002, 01, 01)); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_equal_true : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Complete eq true"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_implicit : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Complete"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_equal_false : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Complete eq false"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(0); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete == false); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_not_true : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete eq true"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_implicit_not : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != true); - } - - public class When_using_eq_filter_on_a_single_nullable_bool_not_false : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=not Complete eq false"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(2); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Complete != false); - } - - public class When_using_eq_filter_on_a_single_nullable_long : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Population eq 10000000000L"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Population == 10000000000L); - } - - public class When_using_eq_filter_on_a_single_nullable_double : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Value eq 111.111"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Value == 111.111); - } - - public class When_using_eq_filter_on_a_single_nullable_float : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Cost eq 111.111f"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Cost == 111.111f); - } - - public class When_using_eq_filter_on_a_single_nullable_byte : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$filter=Code eq 0x00"); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Code == 0x00); - } - - public class When_using_eq_filter_on_a_single_nullable_guid : Filtering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring(string.Format("?$filter=Guid eq guid'{0}'", guidArray[0])); - - private It should_return_the_correct_number_of_records = () => nullableResult.Count().ShouldEqual(1); - - private It should_only_return_matching_records = () => nullableResult.ShouldEachConformTo(o => o.Guid == guidArray[0]); - } - - #endregion - - #region Simple Logic Tests - - public class When_anding_two_filters_together : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Custard' and Age ge 2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard = - () => result.ShouldEachConformTo(o => o.Name == "Custard"); - - private It should_only_return_records_with_age_greater_than_or_equal_to_2 = - () => result.ShouldEachConformTo(o => o.Age >= 2); - } - - public class When_anding_a_filter_and_a_not_filter : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Custard' and not Age lt 2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard = - () => result.ShouldEachConformTo(o => o.Name == "Custard"); - - private It should_only_return_records_with_age_greater_than_or_equal_to_2 = - () => result.ShouldEachConformTo(o => o.Age >= 2); - } - - public class When_oring_two_filters_together : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Banana' or Date gt datetime'2003-01-01T00:00'"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_banana_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Banana" || o.Date > new DateTime(2003, 01, 01)); - } - - public class When_oring_a_filter_and_a_not_filter : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Banana' or not Date le datetime'2003-01-01T00:00'"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_banana_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Banana" || o.Date > new DateTime(2003, 01, 01)); - } - - #endregion - - #region Operator Precedence and Parenthesis tests - - public class When_combining_and_or_filters_together : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple' and Complete eq true or Date gt datetime'2003-01-01T00:00'"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_with_name_equal_to_apples_complete_equal_to_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Apple" && o.Complete || o.Date > new DateTime(2003, 01, 01)); - } - - public class When_combining_and_or_not_filters_together : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple' and Complete eq true or not Date le datetime'2003-01-01T00:00'"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It - should_only_return_records_with_name_equal_to_apples_complete_equal_to_true_or_date_not_less_than_2003_01_01 - = () => result.ShouldEachConformTo(o => o.Name == "Apple" && o.Complete || !(o.Date <= new DateTime(2003, 01, 01))); - } - - public class When_using_parenthesis : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=Name eq 'Apple' and (Complete eq true or Date gt datetime'2003-01-01T00:00')"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_with_name_equal_to_custard_and_result_of_complete_equals_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => o.Name == "Apple" && (o.Complete || o.Date > new DateTime(2003, 01, 01))); - } - - public class When_notting_an_entire_parenthesised_expression : Filtering - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=not (Name eq 'Apple' and (Complete eq true or Date gt datetime'2003-01-01T00:00'))"); - - private It should_return_two_records = () => result.Count().ShouldEqual(9); - - private It should_only_return_records_with_name_equal_to_custard_and_result_of_complete_equals_true_or_date_greater_than_2003_01_01 = - () => result.ShouldEachConformTo(o => !(o.Name == "Apple" && (o.Complete || o.Date > new DateTime(2003, 01, 01)))); - } - - #endregion -} diff --git a/LinqToQueryString.UnitTests/Functions.cs b/LinqToQueryString.UnitTests/Functions.cs deleted file mode 100644 index 1510ec3..0000000 --- a/LinqToQueryString.UnitTests/Functions.cs +++ /dev/null @@ -1,244 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class Functions - { - protected static Exception ex; - - protected static IQueryable result; - - protected static List concreteCollection; - - protected static List complexCollection; - - private Establish context = () => - { - concreteCollection = new List - { - InstanceBuilders.BuildConcrete("Saturday", 1, new DateTime(2001, 01, 01, 01, 05, 00), true), - InstanceBuilders.BuildConcrete("Satnav", 2, new DateTime(2002, 01, 02, 06, 10, 10), false), - InstanceBuilders.BuildConcrete("Saturnalia", 3, new DateTime(2003, 02, 02, 10, 10, 20), true), - InstanceBuilders.BuildConcrete("Saturn", 4, new DateTime(2004, 04, 06, 10, 20, 30), true), - InstanceBuilders.BuildConcrete("Monday", 5, new DateTime(2005, 06, 21, 13, 20, 40), true), - InstanceBuilders.BuildConcrete("Tuesday", 5, new DateTime(2005, 06, 30, 20, 20, 50), true), - InstanceBuilders.BuildConcrete("Burns", 5, new DateTime(2005, 10, 31, 23, 35, 50), true) - }; - - complexCollection = new List - { - new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }, - new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }, - new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }, - new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }, - new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) } - }; - }; - } - - public class When_filtering_on_startswith_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=startswith(Name,'Sat')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_starts_with_Sat = - () => result.ShouldEachConformTo(o => o.Name.StartsWith("Sat")); - } - - public class When_filtering_on_endswith_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=endswith(Name,'day')"); - - private It should_return_four_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_name_ends_with_day = - () => result.ShouldEachConformTo(o => o.Name.EndsWith("day")); - } - - public class When_filtering_on_substringof_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=substringof('urn',Name)"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => o.Name.Contains("urn")); - } - - public class When_filtering_on_multiple_substringof_functions : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$filter=(substringof('Mond',Name)) or (substringof('Tues',Name))"); - - private It should_return_three_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_name_contains_urn = - () => result.ShouldEachConformTo(o => o.Name.Contains("Mond") || o.Name.Contains("Tues")); - } - - public class When_filtering_on_substringof_function_with_escape_character : Filtering - { - private Because of = - () => result = edgeCaseCollection.AsQueryable().LinqToQuerystring(@"?$filter=substringof('\\',Name)"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_only_return_records_where_name_contains_escaped_slash = - () => result.ShouldEachConformTo(o => o.Name.Contains("\\")); - } - - public class When_filtering_on_substringof_function_with_tolower : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=substringof('sat',tolower(Name))"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_contains_sat = - () => result.ShouldEachConformTo(o => o.Name.Contains("Sat")); - } - - public class When_filtering_on_substringof_function_with_toupper : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=substringof('SAT',toupper(Name))"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_only_return_records_where_name_contains_sat = - () => result.ShouldEachConformTo(o => o.Name.Contains("Sat")); - } - - public class When_filtering_on_year_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=year(Date) eq 2005"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_year_is_2005 = - () => result.ShouldEachConformTo(o => o.Date.Year == 2005); - } - - public class When_filtering_on_years_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=years(Date) eq 2005"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_year_is_2005 = - () => result.ShouldEachConformTo(o => o.Date.Year == 2005); - } - - public class When_filtering_on_month_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=month(Date) eq 6"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_month_is_6 = - () => result.ShouldEachConformTo(o => o.Date.Month == 6); - } - - public class When_filtering_on_day_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=day(Date) eq 2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_day_is_2 = - () => result.ShouldEachConformTo(o => o.Date.Day == 2); - } - - public class When_filtering_on_days_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=days(Date) eq 2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_day_is_2 = - () => result.ShouldEachConformTo(o => o.Date.Day == 2); - } - - public class When_filtering_on_hour_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=hour(Date) eq 10"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_hour_is_10 = - () => result.ShouldEachConformTo(o => o.Date.Hour == 10); - } - - public class When_filtering_on_hours_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=hours(Date) eq 10"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_hour_is_10 = - () => result.ShouldEachConformTo(o => o.Date.Hour == 10); - } - - public class When_filtering_on_minute_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=minute(Date) eq 20"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_minute_is_20 = - () => result.ShouldEachConformTo(o => o.Date.Minute == 20); - } - - public class When_filtering_on_minutes_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=minutes(Date) eq 20"); - - private It should_return_three_records = () => result.Count().ShouldEqual(3); - - private It should_only_return_records_where_minute_is_20 = - () => result.ShouldEachConformTo(o => o.Date.Minute == 20); - } - - public class When_filtering_on_second_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=second(Date) eq 50"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_second_is_50 = - () => result.ShouldEachConformTo(o => o.Date.Second == 50); - } - - public class When_filtering_on_seconds_function : Functions - { - private Because of = - () => result = concreteCollection.AsQueryable().LinqToQuerystring(@"?$filter=seconds(Date) eq 50"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_only_return_records_where_second_is_50 = - () => result.ShouldEachConformTo(o => o.Date.Second == 50); - } -} diff --git a/LinqToQueryString.UnitTests/InlineCount.cs b/LinqToQueryString.UnitTests/InlineCount.cs deleted file mode 100644 index 7ac6049..0000000 --- a/LinqToQueryString.UnitTests/InlineCount.cs +++ /dev/null @@ -1,212 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public class InlineCount : Projection - { - protected static Dictionary inlineCountResult; - - protected static IQueryable concreteResult; - - protected static IQueryable GetWrappedResults() - { - return (inlineCountResult["Results"] as IQueryable); - } - - protected static IQueryable> GetWrappedProjectedResults() - { - return (inlineCountResult["Results"] as IQueryable>); - } - } - - public class When_requesting_inline_count_none : InlineCount - { - Because of = () => concreteResult = concreteCollection.AsQueryable().LinqToQuerystring("?$inlinecount=none"); - - private It should_return_all_the_records_normally = () => concreteResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => concreteResult.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => concreteResult.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => concreteResult.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => concreteResult.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => concreteResult.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_an_unfiltered_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(5); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_projected_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(5); - - private It should_project_the_name_and_age_properties_into_the_dictionary = - () => GetWrappedProjectedResults().ShouldEachConformTo( - r => r.ContainsKey("Name") && r.ContainsKey("Age")); - - private It should_only_have_projected_two_properties = - () => GetWrappedProjectedResults().ShouldEachConformTo(r => r.Count == 2); - - private It should_project_the_right_name_for_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_project_the_right_name_for_the_second_record = () => GetWrappedProjectedResults().ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_project_the_right_name_for_the_third_record = () => GetWrappedProjectedResults().ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_project_the_right_name_for_the_fourth_record = () => GetWrappedProjectedResults().ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It sshould_project_the_right_name_for_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - - private It should_project_the_right_age_for_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_project_the_right_age_for_the_second_record = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_project_the_right_age_for_the_third_record = () => GetWrappedProjectedResults().ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_project_the_right_age_for_the_fourth_record = () => GetWrappedProjectedResults().ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_project_the_right_age_for_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_filtered_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$filter=Age ge 3&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(3); - - private It should_return_third_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_an_ordered_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$orderby=Age desc&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_first = () => GetWrappedResults().ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_requesting_inline_count_on_a_top_limited_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$top=3&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(3); - - private It should_return_the_first_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedResults().ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - public class When_requesting_inline_count_on_a_top_limited_projected_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$top=3&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(3); - - private It should_return_the_first_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_third = () => GetWrappedProjectedResults().ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - public class When_requesting_inline_count_on_a_paged_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$skip=2&$top=2&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(2); - - private It should_return_the_third_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedResults().ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_requesting_inline_count_on_a_paged_projected_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$skip=2&$top=2&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(5); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(2); - - private It should_return_the_third_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fourth = () => GetWrappedProjectedResults().ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_requesting_inline_count_on_a_filtered_paged_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$filter=Age ge 3&$skip=2&$top=2&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedResults().Count().ShouldEqual(1); - - private It should_return_the_fifth_record = () => GetWrappedResults().ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_requesting_inline_count_on_a_filtered_paged_projected_query : InlineCount - { - Because of = () => inlineCountResult = concreteCollection.AsQueryable().LinqToQuerystring>("?$filter=Age ge 3&$skip=2&$top=2&$select=Name,Age&$inlinecount=allpages"); - - private It should_return_the_correct_count = () => inlineCountResult["Count"].ShouldEqual(3); - - private It should_return_the_response_within_a_wrapper = () => GetWrappedProjectedResults().Count().ShouldEqual(1); - - private It should_return_the_fifth_record = () => GetWrappedProjectedResults().ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } -} diff --git a/LinqToQueryString.UnitTests/LinqToQueryString.UnitTests.csproj b/LinqToQueryString.UnitTests/LinqToQueryString.UnitTests.csproj deleted file mode 100644 index b8044a2..0000000 --- a/LinqToQueryString.UnitTests/LinqToQueryString.UnitTests.csproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - Debug - AnyCPU - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31} - Library - Properties - LinqToQueryString.UnitTests - LinqToQueryString.UnitTests - v3.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - ..\ - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\Machine.Specifications.0.7.0-Unstable0077\lib\net20\Machine.Specifications.dll - - - ..\packages\Machine.Specifications.Should.0.7.0-Unstable0008\lib\net20\Machine.Specifications.Should.dll - - - ..\packages\Moq.4.1.1309.1617\lib\net35\Moq.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {139B0E4C-BC18-4180-8863-FB248CFDA42E} - LinqToQueryString.Tests - - - {7859C906-95D8-4322-AA44-BC854B065AEE} - LinqToQuerystring - - - - - - - - - - False - - - False - - - False - - - False - - - - - - - - \ No newline at end of file diff --git a/LinqToQueryString.UnitTests/Options.cs b/LinqToQueryString.UnitTests/Options.cs deleted file mode 100644 index df1e7d5..0000000 --- a/LinqToQueryString.UnitTests/Options.cs +++ /dev/null @@ -1,107 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System.Linq; - - using LinqToQuerystring; - - using Machine.Specifications; - - #region No options - - public class When_not_specifying_any_filter_or_options : Filtering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(); - - private It should_return_all_results = () => result.Count().ShouldEqual(11); - } - - #endregion - - #region Force dynamic properties - - public class When_using_not_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=not Age eq 25", forceDynamicProperties: true); - - private It should_return_three_results = () => result.Count().ShouldEqual(3); - } - - public class When_using_ge_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=Age ge 25", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(2); - } - - public class When_using_gt_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=Age gt 25", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(1); - } - - public class When_using_le_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=Age le 25", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(3); - } - - public class When_using_lt_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=Age lt 25", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(2); - } - - public class When_using_eq_filter_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$filter=Age eq 25", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(1); - } - - public class When_using_order_by_on_a_dynamic_type_with_force_dynamic_true : Dynamics - { - private Because of = () => result = collection.AsQueryable().LinqToQuerystring("$orderby=Age", forceDynamicProperties: true); - - private It should_return_two_results = () => result.Count().ShouldEqual(4); - } - - #endregion - - #region Max page size - - public class When_using_top_3_and_the_page_size_is_5 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$top=3", maxPageSize: 5); - - private It should_return_three_record = () => result.Count().ShouldEqual(3); - - private It should_start_with_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_follow_with_the_second_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_follow_with_the_third_record = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - public class When_using_top_3_and_the_page_size_is_1 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$top=3", maxPageSize: 1); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_start_with_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_an_empty_filter_and_page_size_is_1 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring(maxPageSize: 1); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_start_with_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - #endregion -} diff --git a/LinqToQueryString.UnitTests/PagingAndOrdering.cs b/LinqToQueryString.UnitTests/PagingAndOrdering.cs deleted file mode 100644 index a961f71..0000000 --- a/LinqToQueryString.UnitTests/PagingAndOrdering.cs +++ /dev/null @@ -1,797 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class PagingAndOrdering - { - protected static IQueryable result; - - protected static IQueryable complexResult; - - protected static IQueryable nullableResult; - - protected static List concreteCollection; - - protected static List complexCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - concreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true), - InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true), - InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false), - InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) - }; - - complexCollection = new List - { - new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }, - new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }, - new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }, - new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }, - new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) } - }; - - - nullableCollection = new List - { - InstanceBuilders.BuildNull(3, new DateTime(2003, 01, 01), true, 30000000000, 333.333, 333.333f, 0xEE, guidArray[2]), - InstanceBuilders.BuildNull(1, new DateTime(2001, 01, 01), false, 10000000000, 111.111, 111.111f, 0xDD, guidArray[0]), - InstanceBuilders.BuildNull(), - InstanceBuilders.BuildNull(2, new DateTime(2002, 01, 01), true, 20000000000, 222.222, 222.222f, 0xCC, guidArray[1]), - }; - }; - } - - #region Top Tests - - public class When_using_top_1 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$top=1"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_top_3 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$top=3"); - - private It should_return_three_record = () => result.Count().ShouldEqual(3); - - private It should_start_with_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_follow_with_the_second_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_follow_with_the_third_record = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - #endregion - - #region Skip Tests - - public class When_using_skip_1 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$skip=1"); - - private It should_return_four_records = () => result.Count().ShouldEqual(4); - - private It should_start_with_the_second_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_follow_with_the_third_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_follow_with_the_fifth_record = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_skip_3 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$skip=3"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_follow_with_the_fifth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - #endregion - - #region Skip and Top Tests - - public class When_using_skip_2_and_top_2 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$skip=2&$top=2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_skip_3_and_top_1 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$skip=3&$top=1"); - - private It should_return_one_record = () => result.Count().ShouldEqual(1); - - private It should_start_with_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_top_2_and_skip_2 : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$top=2&$skip=2"); - - private It should_return_two_records = () => result.Count().ShouldEqual(2); - - private It should_start_with_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_follow_with_the_fourth_record = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Single Integer Tests - - public class When_using_order_by_on_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_asc_on_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age asc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_desc_on_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Age desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Nullable Integer Tests - - public class When_using_order_by_on_nullable_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Age"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - } - - public class When_using_order_by_asc_on_nullable_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Age asc"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - } - - public class When_using_order_by_desc_on_nullable_integer_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Age desc"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_first_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_third = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - } - - #endregion - - #region OrderBy Single String Tests - - public class When_using_order_by_on_string_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_asc_on_string_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name asc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_desc_on_string_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Name desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - #endregion - - #region OrderBy Single Date Tests - - public class When_using_order_by_on_date_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_asc_on_date_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date asc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_desc_on_date_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Date desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_be_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - #endregion - - #region OrderBy Single Boolean Tests - - public class When_using_order_by_on_bool_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_false_value_first = () => result.ElementAt(0).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_second = () => result.ElementAt(1).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fourth = () => result.ElementAt(3).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fifth = () => result.ElementAt(4).Complete.ShouldBeTrue(); - } - - public class When_using_order_by_asc_on_bool_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete asc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_false_value_first = () => result.ElementAt(0).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_second = () => result.ElementAt(1).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fourth = () => result.ElementAt(3).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_fifth = () => result.ElementAt(4).Complete.ShouldBeTrue(); - } - - public class When_using_order_by_desc_on_bool_with_one_criteria : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_have_sorted_a_true_value_first = () => result.ElementAt(0).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_second = () => result.ElementAt(1).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_true_value_third = () => result.ElementAt(2).Complete.ShouldBeTrue(); - - private It should_have_sorted_a_false_value_fourth = () => result.ElementAt(3).Complete.ShouldBeFalse(); - - private It should_have_sorted_a_false_value_fifth = () => result.ElementAt(4).Complete.ShouldBeFalse(); - } - - #endregion - - #region OrderBy Nullable Boolean Tests - - public class When_using_order_by_on_nullable_boolean_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - } - - public class When_using_order_by_asc_on_nullable_boolean_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete asc"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_third_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_first = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - } - - public class When_using_order_by_desc_on_nullable_boolean_with_one_criteria : PagingAndOrdering - { - private Because of = () => nullableResult = nullableCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc"); - - private It should_return_four_records = () => nullableResult.Count().ShouldEqual(4); - - private It should_return_the_first_record = () => nullableResult.ElementAt(0).Age.ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_be_then_be_followed_by_the_fourth = () => nullableResult.ElementAt(1).Age.ShouldEqual(nullableCollection.ElementAt(3).Age); - - private It should_be_then_be_followed_by_the_second = () => nullableResult.ElementAt(2).Age.ShouldEqual(nullableCollection.ElementAt(1).Age); - - private It should_be_then_be_followed_by_the_third = () => nullableResult.ElementAt(3).Age.ShouldEqual(nullableCollection.ElementAt(2).Age); - } - - #endregion - - #region OrderBy Multiple Properties - - public class When_using_order_by_on_two_properties : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete,Age"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - } - - public class When_using_order_by_on_one_descending_and_one_ascending : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc,Age"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_using_order_by_on_one_ascending_and_one_descending : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete,Age desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_then_be_followed_by_the_first = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - } - - public class When_using_order_by_on_two_properties_both_descending : PagingAndOrdering - { - private Because of = () => result = concreteCollection.AsQueryable().LinqToQuerystring("?$orderby=Complete desc,Age desc"); - - private It should_return_five_records = () => result.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => result.ElementAt(0).Name.ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_then_be_followed_by_the_second = () => result.ElementAt(1).Name.ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_then_be_followed_by_the_fourth = () => result.ElementAt(2).Name.ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_then_be_followed_by_the_fifth = () => result.ElementAt(3).Name.ShouldEqual(concreteCollection.ElementAt(4).Name); - - private It should_then_be_followed_by_the_third = () => result.ElementAt(4).Name.ShouldEqual(concreteCollection.ElementAt(2).Name); - } - - #endregion - - #region OrderBy Complex Types - - public class When_using_order_by_on_complex_types_using_IComparable : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_asc_on_complex_types_using_IComparable : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete asc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_desc_on_complex_types_using_IComparable : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_first_ = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - #endregion - - #region OrderBy SubProperties - - public class When_using_order_by_on_a_single_subproperty : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring(@"?$orderby=Concrete/Age"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_asc_on_a_single_subproperty : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring(@"?$orderby=Concrete/Age asc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_desc_on_a_single_subproperty : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Age desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_be_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_be_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_be_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_be_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - #endregion - - #region OrderBy Multiple SubProperties - - public class When_using_order_by_on_two_sub_properties : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Concrete/Age"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - } - - public class When_using_order_by_on_two_sub_properties_one_descending_and_one_ascending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Concrete/Age"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - } - - public class When_using_order_by_on_two_sub_properties_one_ascending_and_one_descending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Concrete/Age desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_on_two_sub_properties_both_descending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Concrete/Age desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_first_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - } - - #endregion - - #region OrderBy Mixed Properties and SubProperties - - public class When_using_order_by_on_mixed_properties : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Title"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fifth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - } - - public class When_using_order_by_on_mixed_properties_one_descending_and_one_ascending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Title"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_second_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - } - - public class When_using_order_by_on_mixed_properties_one_ascending_and_one_descending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete,Title desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_third_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - - private It should_then_be_followed_by_the_fourth = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - } - - public class When_using_order_by_on_mixed_properties_both_descending : PagingAndOrdering - { - private Because of = () => complexResult = complexCollection.AsQueryable().LinqToQuerystring("?$orderby=Concrete/Complete desc,Title desc"); - - private It should_return_five_records = () => complexResult.Count().ShouldEqual(5); - - private It should_return_the_fourth_record = () => complexResult.ElementAt(0).Title.ShouldEqual(complexCollection.ElementAt(3).Title); - - private It should_then_be_followed_by_the_first = () => complexResult.ElementAt(1).Title.ShouldEqual(complexCollection.ElementAt(0).Title); - - private It should_then_be_followed_by_the_second = () => complexResult.ElementAt(2).Title.ShouldEqual(complexCollection.ElementAt(1).Title); - - private It should_then_be_followed_by_the_third = () => complexResult.ElementAt(3).Title.ShouldEqual(complexCollection.ElementAt(2).Title); - - private It should_then_be_followed_by_the_fifth = () => complexResult.ElementAt(4).Title.ShouldEqual(complexCollection.ElementAt(4).Title); - } - - #endregion -} - diff --git a/LinqToQueryString.UnitTests/Projection.cs b/LinqToQueryString.UnitTests/Projection.cs deleted file mode 100644 index 4ad05b5..0000000 --- a/LinqToQueryString.UnitTests/Projection.cs +++ /dev/null @@ -1,258 +0,0 @@ -namespace LinqToQueryString.UnitTests -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQueryString.Tests; - - using LinqToQuerystring; - - using Machine.Specifications; - - public abstract class Projection - { - protected static Exception ex; - - protected static IQueryable> result; - - protected static IQueryable> complexResult; - - protected static IQueryable> nullableResult; - - protected static List concreteCollection; - - protected static List complexCollection; - - protected static List nullableCollection; - - protected static Guid[] guidArray; - - private Establish context = () => - { - guidArray = Enumerable.Range(1, 5).Select(o => Guid.NewGuid()).ToArray(); - - concreteCollection = new List - { - InstanceBuilders.BuildConcrete("Apple", 1, new DateTime(2001, 01, 01), true), - InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2002, 01, 01), false), - InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2003, 01, 01), true), - InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2004, 01, 01), true), - InstanceBuilders.BuildConcrete("Eggs", 5, new DateTime(2005, 01, 01), true) - }; - - complexCollection = new List - { - new ComplexClass { Title = "Charles", Concrete = InstanceBuilders.BuildConcrete("Apple", 5, new DateTime(2005, 01, 01), true) }, - new ComplexClass { Title = "Andrew", Concrete = InstanceBuilders.BuildConcrete("Custard", 3, new DateTime(2007, 01, 01), true) }, - new ComplexClass { Title = "David", Concrete = InstanceBuilders.BuildConcrete("Banana", 2, new DateTime(2003, 01, 01), false) }, - new ComplexClass { Title = "Edward", Concrete = InstanceBuilders.BuildConcrete("Eggs", 1, new DateTime(2000, 01, 01), true) }, - new ComplexClass { Title = "Boris", Concrete = InstanceBuilders.BuildConcrete("Dogfood", 4, new DateTime(2009, 01, 01), false) } - }; - - nullableCollection = new List - { - InstanceBuilders.BuildNull(), - InstanceBuilders.BuildNull(1, new DateTime(2002, 01, 01), true, 10000000000, 111.111, 111.111f, 0x00, guidArray[0]) - }; - }; - } - - #region Single Property Tests - - public class When_selecting_a_single_string_property : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Name"); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo(r => r.ContainsKey("Name")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_selecting_a_single_int_property : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Age"); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Age")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - } - - public class When_selecting_a_single_datetime_property : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Date"); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Date")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Date"].ShouldEqual(concreteCollection.ElementAt(0).Date); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Date"].ShouldEqual(concreteCollection.ElementAt(1).Date); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Date"].ShouldEqual(concreteCollection.ElementAt(2).Date); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Date"].ShouldEqual(concreteCollection.ElementAt(3).Date); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Date"].ShouldEqual(concreteCollection.ElementAt(4).Date); - } - - public class When_selecting_a_single_boolean_property : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Complete"); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Complete")); - - private It should_only_have_projected_the_one_property = - () => result.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Complete"].ShouldEqual(concreteCollection.ElementAt(0).Complete); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Complete"].ShouldEqual(concreteCollection.ElementAt(1).Complete); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Complete"].ShouldEqual(concreteCollection.ElementAt(2).Complete); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Complete"].ShouldEqual(concreteCollection.ElementAt(3).Complete); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Complete"].ShouldEqual(concreteCollection.ElementAt(4).Complete); - } - - public class When_selecting_multiple_properties : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Name,Age"); - - private It should_project_the_name_and_age_properties_into_the_dictionary = - () => result.ShouldEachConformTo( - r => r.ContainsKey("Name") && r.ContainsKey("Age")); - - private It should_only_have_projected_two_properties = - () => result.ShouldEachConformTo(r => r.Count == 2); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_project_the_right_name_for_the_first_record = () => result.ElementAt(0)["Age"].ShouldEqual(concreteCollection.ElementAt(0).Age); - - private It should_project_the_right_name_for_the_second_record = () => result.ElementAt(1)["Age"].ShouldEqual(concreteCollection.ElementAt(1).Age); - - private It should_project_the_right_name_for_the_third_record = () => result.ElementAt(2)["Age"].ShouldEqual(concreteCollection.ElementAt(2).Age); - - private It should_project_the_right_name_for_the_fourth_record = () => result.ElementAt(3)["Age"].ShouldEqual(concreteCollection.ElementAt(3).Age); - - private It sshould_project_the_right_name_for_the_fifth_record = () => result.ElementAt(4)["Age"].ShouldEqual(concreteCollection.ElementAt(4).Age); - - private It should_project_the_right_age_for_the_first_record = () => result.ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_project_the_right_age_for_the_second_record = () => result.ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_project_the_right_age_for_the_third_record = () => result.ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_project_the_right_age_for_the_fourth_record = () => result.ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_project_the_right_age_for_the_fifth_record = () => result.ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - public class When_selecting_a_nullable_int_property : Projection - { - private Because of = - () => - nullableResult = nullableCollection.AsQueryable().LinqToQuerystring>>("?$select=Age"); - - private It should_project_the_name_properties_into_the_dictionary = - () => nullableResult.ShouldEachConformTo( - r => r.ContainsKey("Age")); - - private It should_only_have_projected_the_one_property = - () => nullableResult.ShouldEachConformTo(r => r.Count == 1); - - private It should_contain_2_results = () => nullableResult.Count().ShouldEqual(2); - - private It should_start_with_the_first_record = () => nullableResult.ElementAt(0)["Age"].ShouldEqual(nullableCollection.ElementAt(0).Age); - - private It should_then_return_the_second_record = () => nullableResult.ElementAt(1)["Age"].ShouldEqual(nullableCollection.ElementAt(1).Age); - } - - #endregion - - #region Complex Property Tests - - - - #endregion - - #region Projecting and Ordering - - public class When_selecting_a_single_string_property_then_ordering_it : Projection - { - private Because of = - () => - result = concreteCollection.AsQueryable().LinqToQuerystring>>("?$select=Name,Age&$orderby=Name"); - - private It should_project_the_name_properties_into_the_dictionary = - () => result.ShouldEachConformTo(r => r.ContainsKey("Name")); - - private It should_have_projected_both_properties = - () => result.ShouldEachConformTo(r => r.Count == 2); - - private It should_contain_5_results = () => result.Count().ShouldEqual(5); - - private It should_start_with_the_first_record = () => result.ElementAt(0)["Name"].ShouldEqual(concreteCollection.ElementAt(0).Name); - - private It should_be_followed_by_the_second_record = () => result.ElementAt(1)["Name"].ShouldEqual(concreteCollection.ElementAt(1).Name); - - private It should_be_followed_by_the_third_record = () => result.ElementAt(2)["Name"].ShouldEqual(concreteCollection.ElementAt(2).Name); - - private It should_be_followed_by_the_fourth_record = () => result.ElementAt(3)["Name"].ShouldEqual(concreteCollection.ElementAt(3).Name); - - private It should_be_followed_by_the_fifth_record = () => result.ElementAt(4)["Name"].ShouldEqual(concreteCollection.ElementAt(4).Name); - } - - #endregion -} diff --git a/LinqToQueryString.UnitTests/Properties/AssemblyInfo.cs b/LinqToQueryString.UnitTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 7136902..0000000 --- a/LinqToQueryString.UnitTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LinqToQueryString.UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LinqToQueryString.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7a619991-aea1-4715-987d-e76198f0d699")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinqToQueryString.UnitTests/packages.config b/LinqToQueryString.UnitTests/packages.config deleted file mode 100644 index fea2b6a..0000000 --- a/LinqToQueryString.UnitTests/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Core.sln b/LinqToQuerystring.Core.sln deleted file mode 100644 index 78208aa..0000000 --- a/LinqToQuerystring.Core.sln +++ /dev/null @@ -1,59 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToQuerystring", "LinqToQuerystring\LinqToQuerystring.csproj", "{7859C906-95D8-4322-AA44-BC854B065AEE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToQueryString.UnitTests", "LinqToQueryString.UnitTests\LinqToQueryString.UnitTests.csproj", "{B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{F5C6F2FB-E3FC-4787-B637-FC4AE2F70050}" - ProjectSection(SolutionItems) = preProject - .nuget\NuGet.Config = .nuget\NuGet.Config - .nuget\NuGet.exe = .nuget\NuGet.exe - .nuget\NuGet.targets = .nuget\NuGet.targets - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToQueryString.IntegrationTests.Sql", "LinqToQueryString.IntegrationTests\LinqToQueryString.IntegrationTests.Sql.csproj", "{354C3452-BCDC-4048-B897-8CC719298B87}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToQueryString.Tests", "LinqToQueryString.Tests\LinqToQueryString.Tests.csproj", "{139B0E4C-BC18-4180-8863-FB248CFDA42E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToQuerystring.IntegrationTests.Mongo", "LinqToQuerystring.IntegrationTests.Mongo\LinqToQuerystring.IntegrationTests.Mongo.csproj", "{F66422D5-B9B0-4C54-9678-C2FD68F063AA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2313C896-8F93-46A4-9A5A-B148146256F3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7859C906-95D8-4322-AA44-BC854B065AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7859C906-95D8-4322-AA44-BC854B065AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7859C906-95D8-4322-AA44-BC854B065AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7859C906-95D8-4322-AA44-BC854B065AEE}.Release|Any CPU.Build.0 = Release|Any CPU - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31}.Release|Any CPU.Build.0 = Release|Any CPU - {354C3452-BCDC-4048-B897-8CC719298B87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {354C3452-BCDC-4048-B897-8CC719298B87}.Debug|Any CPU.Build.0 = Debug|Any CPU - {354C3452-BCDC-4048-B897-8CC719298B87}.Release|Any CPU.ActiveCfg = Release|Any CPU - {354C3452-BCDC-4048-B897-8CC719298B87}.Release|Any CPU.Build.0 = Release|Any CPU - {139B0E4C-BC18-4180-8863-FB248CFDA42E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {139B0E4C-BC18-4180-8863-FB248CFDA42E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {139B0E4C-BC18-4180-8863-FB248CFDA42E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {139B0E4C-BC18-4180-8863-FB248CFDA42E}.Release|Any CPU.Build.0 = Release|Any CPU - {F66422D5-B9B0-4C54-9678-C2FD68F063AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F66422D5-B9B0-4C54-9678-C2FD68F063AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F66422D5-B9B0-4C54-9678-C2FD68F063AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F66422D5-B9B0-4C54-9678-C2FD68F063AA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {354C3452-BCDC-4048-B897-8CC719298B87} = {2313C896-8F93-46A4-9A5A-B148146256F3} - {139B0E4C-BC18-4180-8863-FB248CFDA42E} = {2313C896-8F93-46A4-9A5A-B148146256F3} - {F66422D5-B9B0-4C54-9678-C2FD68F063AA} = {2313C896-8F93-46A4-9A5A-B148146256F3} - {B60C3B0C-CAD7-4ED2-A1DD-7A6482504F31} = {2313C896-8F93-46A4-9A5A-B148146256F3} - EndGlobalSection -EndGlobal diff --git a/LinqToQuerystring.Demo.Nancy/Bootstrapper.cs b/LinqToQuerystring.Demo.Nancy/Bootstrapper.cs deleted file mode 100644 index 0d1c287..0000000 --- a/LinqToQuerystring.Demo.Nancy/Bootstrapper.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace LinqToQuerystring.Demo.Nancy -{ - using global::Nancy; - using global::Nancy.Bootstrapper; - using global::Nancy.Diagnostics; - using global::Nancy.TinyIoc; - - public class Bootstrapper : DefaultNancyBootstrapper - { - protected override DiagnosticsConfiguration DiagnosticsConfiguration - { - get { return new DiagnosticsConfiguration { Password = @"password" }; } - } - - protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) - { - StaticConfiguration.EnableRequestTracing = true; - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/LinqToQuerystring.Demo.Nancy.csproj b/LinqToQuerystring.Demo.Nancy/LinqToQuerystring.Demo.Nancy.csproj deleted file mode 100644 index b1204c6..0000000 --- a/LinqToQuerystring.Demo.Nancy/LinqToQuerystring.Demo.Nancy.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {DD871B26-176A-49C3-A022-CE3FC80B62E0} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - LinqToQuerystring.Demo.Nancy - LinqToQuerystring.Demo.Nancy - v4.5 - true - - - - - ..\ - true - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - False - ..\packages\Nancy.0.20.0\lib\net40\Nancy.dll - - - False - ..\packages\Nancy.Hosting.Aspnet.0.20.0\lib\net40\Nancy.Hosting.Aspnet.dll - - - - - - - - - - - - - - - - - - Web.config - - - Web.config - - - - - {60e15ff4-5729-4b80-b30a-e5ba395bd039} - LinqToQuerystring.Nancy - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 53552 - / - http://localhost:52230/ - False - False - - - False - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/Models/Movie.cs b/LinqToQuerystring.Demo.Nancy/Models/Movie.cs deleted file mode 100644 index fc3e6a4..0000000 --- a/LinqToQuerystring.Demo.Nancy/Models/Movie.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace LinqToQuerystring.Demo.Models -{ - using System; - - public class Movie - { - public string Title { get; set; } - - public int DurationInMinutes { get; set; } - - public DateTime ReleaseDate { get; set; } - - public string Director { get; set; } - - public int MetaScore { get; set; } - - public bool Recommended { get; set; } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/MoviesModule.cs b/LinqToQuerystring.Demo.Nancy/MoviesModule.cs deleted file mode 100644 index 3d078e2..0000000 --- a/LinqToQuerystring.Demo.Nancy/MoviesModule.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace LinqToQuerystring.Demo.Nancy -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using LinqToQuerystring.Demo.Models; - using LinqToQuerystring.Nancy; - - using global::Nancy; - - public class MoviesModule : NancyModule - { - public MoviesModule() - { - Get["/"] = - _ => new List - { - new Movie - { - Title = "Matrix (The)", - ReleaseDate = new DateTime(1999, 3, 31), - DurationInMinutes = 136, - MetaScore = 73, - Director = "Wachowski Brothers", - Recommended = true - }, - new Movie - { - Title = "Avatar", - ReleaseDate = new DateTime(2009, 12, 17), - DurationInMinutes = 162, - MetaScore = 83, - Director = "James Cameron", - Recommended = false - }, - new Movie - { - Title = "Spaceballs", - ReleaseDate = new DateTime(1987, 6, 24), - DurationInMinutes = 96, - MetaScore = 46, - Director = "Mel Brooks", - Recommended = true - }, - new Movie - { - Title = "Return of the Jedi", - ReleaseDate = new DateTime(1983, 6, 2), - DurationInMinutes = 134, - MetaScore = 52, - Director = "Richard Marquand", - Recommended = true - }, - new Movie - { - Title = "Fellowship of the ring (The)", - ReleaseDate = new DateTime(2001, 12, 10), - DurationInMinutes = 228, - MetaScore = 92, - Director = "Peter Jackson", - Recommended = true - }, - new Movie - { - Title = "There and Back Again, An Unexpected Journey", - ReleaseDate = new DateTime(2012, 12, 14), - DurationInMinutes = 169, - MetaScore = 58, - Director = "Peter Jackson", - Recommended = false - }, - }.AsQueryable() - .LinqToQuerystring((IDictionary)this.Context.Request.Query); - } - } - -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/Properties/AssemblyInfo.cs b/LinqToQuerystring.Demo.Nancy/Properties/AssemblyInfo.cs deleted file mode 100644 index d03ff06..0000000 --- a/LinqToQuerystring.Demo.Nancy/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LinqToQuerystring.Demo.Nancy")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LinqToQuerystring.Demo.Nancy")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("92a4fb3b-8056-4b3a-9970-7718f301757c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinqToQuerystring.Demo.Nancy/Web.Debug.config b/LinqToQuerystring.Demo.Nancy/Web.Debug.config deleted file mode 100644 index 2e302f9..0000000 --- a/LinqToQuerystring.Demo.Nancy/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/Web.Release.config b/LinqToQuerystring.Demo.Nancy/Web.Release.config deleted file mode 100644 index c358444..0000000 --- a/LinqToQuerystring.Demo.Nancy/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/Web.config b/LinqToQuerystring.Demo.Nancy/Web.config deleted file mode 100644 index 6c4d1ee..0000000 --- a/LinqToQuerystring.Demo.Nancy/Web.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo.Nancy/packages.config b/LinqToQuerystring.Demo.Nancy/packages.config deleted file mode 100644 index 15750b5..0000000 --- a/LinqToQuerystring.Demo.Nancy/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo/App_Start/BundleConfig.cs b/LinqToQuerystring.Demo/App_Start/BundleConfig.cs deleted file mode 100644 index a346b7d..0000000 --- a/LinqToQuerystring.Demo/App_Start/BundleConfig.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Web; -using System.Web.Optimization; - -namespace LinqToQuerystring.Demo -{ - public class BundleConfig - { - // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725 - public static void RegisterBundles(BundleCollection bundles) - { - bundles.Add(new ScriptBundle("~/bundles/jquery").Include( - "~/Scripts/jquery-{version}.js")); - - bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( - "~/Scripts/jquery-ui-{version}.js")); - - bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( - "~/Scripts/jquery.unobtrusive*", - "~/Scripts/jquery.validate*")); - - bundles.Add(new ScriptBundle("~/bundles/knockout").Include( - "~/Scripts/knockout-{version}.js")); - - bundles.Add(new ScriptBundle("~/bundles/odata").Include( - "~/Scripts/jquery.ODataFilterUI*")); - - // Use the development version of Modernizr to develop with and learn from. Then, when you're - // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. - bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( - "~/Scripts/modernizr-*")); - - bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css")); - - bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( - "~/Content/themes/base/jquery.ui.core.css", - "~/Content/themes/base/jquery.ui.resizable.css", - "~/Content/themes/base/jquery.ui.selectable.css", - "~/Content/themes/base/jquery.ui.accordion.css", - "~/Content/themes/base/jquery.ui.autocomplete.css", - "~/Content/themes/base/jquery.ui.button.css", - "~/Content/themes/base/jquery.ui.dialog.css", - "~/Content/themes/base/jquery.ui.slider.css", - "~/Content/themes/base/jquery.ui.tabs.css", - "~/Content/themes/base/jquery.ui.datepicker.css", - "~/Content/themes/base/jquery.ui.progressbar.css", - "~/Content/themes/base/jquery.ui.theme.css")); - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/App_Start/FilterConfig.cs b/LinqToQuerystring.Demo/App_Start/FilterConfig.cs deleted file mode 100644 index 91f752a..0000000 --- a/LinqToQuerystring.Demo/App_Start/FilterConfig.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Web.Mvc; - -namespace LinqToQuerystring.Demo -{ - public class FilterConfig - { - public static void RegisterGlobalFilters(GlobalFilterCollection filters) - { - - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/App_Start/RouteConfig.cs b/LinqToQuerystring.Demo/App_Start/RouteConfig.cs deleted file mode 100644 index ae19d21..0000000 --- a/LinqToQuerystring.Demo/App_Start/RouteConfig.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; - -namespace LinqToQuerystring.Demo -{ - public class RouteConfig - { - public static void RegisterRoutes(RouteCollection routes) - { - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - - routes.MapRoute( - name: "Default", - url: "{controller}/{action}/{id}", - defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } - ); - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/App_Start/WebApiConfig.cs b/LinqToQuerystring.Demo/App_Start/WebApiConfig.cs deleted file mode 100644 index f825473..0000000 --- a/LinqToQuerystring.Demo/App_Start/WebApiConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace LinqToQuerystring.Demo -{ - using System.Web.Http; - - public static class WebApiConfig - { - public static void Register(HttpConfiguration config) - { - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - - // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable return type. - // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries. - // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712. - //config.EnableQuerySupport(); - - // To disable tracing in your application, please comment out or remove the following line of code - // For more information, refer to: http://www.asp.net/web-api - config.EnableSystemDiagnosticsTracing(); - } - } -} diff --git a/LinqToQuerystring.Demo/Content/Site.css b/LinqToQuerystring.Demo/Content/Site.css deleted file mode 100644 index cdcec94..0000000 --- a/LinqToQuerystring.Demo/Content/Site.css +++ /dev/null @@ -1,827 +0,0 @@ -html { - background-color: #e2e2e2; - margin: 0; - padding: 0; -} - -body { - background-color: #fff; - border-top: solid 10px #000; - color: #333; - font-size: .85em; - font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif; - margin: 0; - padding: 0; -} - - -/* Filter styles */ -#filter + div li { - display: inline; - margin: 0px; - padding: 0px; -} - -div > span { - display: inline-block; - margin-top: 10px; - margin-bottom: 15px; -} - -#filter + div div { - display: inline-block; -} - -#filter + div > ol { - display: block; - margin: 0px; - padding: 0px; -} - -#filter + div > ol ol { - display: inline-block; - margin-left: 40px; - padding: 0px; -} - -#filter + div a { - margin-left: 10px; -} - -#filter + div a, #filter + div + a { - display: inline-block; - text-transform: capitalize; - text-decoration:none; -} - -.filterRemove, .addAnother { - background-color: #d3dce0; - border: 1px solid #787878; - cursor: pointer; - font-size: 1.2em; - font-weight: 600; - padding: 7px; - margin-right: 8px; - width: auto; -} - -/* End Filter styles */ - -a { - color: #333; - outline: none; - padding-left: 3px; - padding-right: 3px; - text-decoration: underline; -} - - a:link, a:visited, - a:active, a:hover { - color: #333; - } - - a:hover { - background-color: #c7d1d6; - } - -header, footer, hgroup, -nav, section { - display: block; -} - -mark { - background-color: #a6dbed; - padding-left: 5px; - padding-right: 5px; -} - -.float-left { - float: left; -} - -.float-right { - float: right; -} - -.clear-fix:after { - content: "."; - clear: both; - display: block; - height: 0; - visibility: hidden; -} - -h1, h2, h3, -h4, h5, h6 { - color: #000; - margin-bottom: 0; - padding-bottom: 0; -} - -h1 { - font-size: 2em; -} - -h2 { - font-size: 1.75em; -} - -h3 { - font-size: 1.2em; -} - -h4 { - font-size: 1.1em; -} - -h5, h6 { - font-size: 1em; -} - - h5 a:link, h5 a:visited, h5 a:active { - padding: 0; - text-decoration: none; - } - - -/* main layout -----------------------------------------------------------*/ -.content-wrapper { - margin: 0 auto; - max-width: 960px; -} - -#body { - background-color: #efeeef; - clear: both; - padding-bottom: 35px; -} - -.main-content { - background: url("../Images/accent.png") no-repeat; - padding-left: 10px; - padding-top: 30px; -} - -.featured + .main-content { - background: url("../Images/heroAccent.png") no-repeat; -} - -header .content-wrapper { - padding-top: 20px; -} - -footer { - clear: both; - background-color: #e2e2e2; - font-size: .8em; - height: 100px; -} - - -/* site title -----------------------------------------------------------*/ -.site-title { - color: #c8c8c8; - font-family: Rockwell, Consolas, "Courier New", Courier, monospace; - font-size: 2.3em; - margin: 0; -} - - .site-title a, .site-title a:hover, .site-title a:active { - background: none; - color: #c8c8c8; - outline: none; - text-decoration: none; - } - - -/* login -----------------------------------------------------------*/ -#login { - display: block; - font-size: .85em; - margin: 0 0 10px; - text-align: right; -} - - #login a { - background-color: #d3dce0; - margin-left: 10px; - margin-right: 3px; - padding: 2px 3px; - text-decoration: none; - } - - #login a.username { - background: none; - margin: 0; - padding: 0; - text-decoration: underline; - } - - #login ul { - margin: 0; - } - - #login li { - display: inline; - list-style: none; - } - - -/* menu -----------------------------------------------------------*/ -ul#menu { - font-size: 1.3em; - font-weight: 600; - margin: 0 0 5px; - padding: 0; - text-align: right; -} - - ul#menu li { - display: inline; - list-style: none; - padding-left: 15px; - } - - ul#menu li a { - background: none; - color: #999; - text-decoration: none; - } - - ul#menu li a:hover { - color: #333; - text-decoration: none; - } - - -/* page elements -----------------------------------------------------------*/ -/* featured */ -.featured { - background-color: #fff; -} - - .featured .content-wrapper { - background-color: #7ac0da; - background-image: -ms-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%); - background-image: -o-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%); - background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7ac0da), color-stop(1, #a4d4e6)); - background-image: -webkit-linear-gradient(left, #7ac0da 0%, #a4d4e6 100%); - background-image: linear-gradient(left, #7ac0da 0%, #a4d4e6 100%); - color: #3e5667; - padding: 20px 40px 30px 40px; - } - - .featured hgroup.title h1, .featured hgroup.title h2 { - color: #fff; - } - - .featured p { - font-size: 1.1em; - } - -/* page titles */ -hgroup.title { - margin-bottom: 10px; -} - - hgroup.title h1, hgroup.title h2 { - display: inline; - } - - hgroup.title h2 { - font-weight: normal; - margin-left: 3px; - } - -/* features */ -section.feature { - width: 300px; - float: left; - padding: 10px; -} - -/* ordered list */ -ol.round { - list-style-type: none; - padding-left: 0; -} - - ol.round li { - padding-left: 45px; - } - - ol.round li.zero { - background: url("../Images/orderedList0.png") no-repeat; - } - - ol.round li.one { - background: url("../Images/orderedList1.png") no-repeat; - } - - ol.round li.two { - background: url("../Images/orderedList2.png") no-repeat; - } - - ol.round li.three { - background: url("../Images/orderedList3.png") no-repeat; - } - - ol.round li.four { - background: url("../Images/orderedList4.png") no-repeat; - } - - ol.round li.five { - background: url("../Images/orderedList5.png") no-repeat; - } - - ol.round li.six { - background: url("../Images/orderedList6.png") no-repeat; - } - - ol.round li.seven { - background: url("../Images/orderedList7.png") no-repeat; - } - - ol.round li.eight { - background: url("../Images/orderedList8.png") no-repeat; - } - - ol.round li.nine { - background: url("../Images/orderedList9.png") no-repeat; - } - -/* content */ -article { - float: left; - width: 70%; -} - -aside { - float: right; - width: 25%; -} - - aside ul { - list-style: none; - padding: 0; - } - - aside ul li { - background: url("../Images/bullet.png") no-repeat 0 50%; - padding: 2px 0 2px 20px; - } - -.label { - font-weight: 700; -} - -/* login page */ -#loginForm { - border-right: solid 2px #c8c8c8; - float: left; - width: 55%; -} - - #loginForm .validation-error { - display: block; - margin-left: 15px; - } - - #loginForm .validation-summary-errors ul { - margin: 0; - padding: 0; - } - - #loginForm .validation-summary-errors li { - display: inline; - list-style: none; - margin: 0; - } - - #loginForm input { - width: 250px; - } - - #loginForm input[type="checkbox"], - #loginForm input[type="submit"], - #loginForm input[type="button"], - #loginForm button { - width: auto; - } - -#socialLoginForm { - margin-left: 40px; - float: left; - width: 40%; -} - - #socialLoginForm h2 { - margin-bottom: 5px; - } - -#socialLoginList button { - margin-bottom: 12px; -} - -#logoutForm { - display: inline; -} - -/* contact */ -.contact h3 { - font-size: 1.2em; -} - -.contact p { - margin: 5px 0 0 10px; -} - -.contact iframe { - border: 1px solid #333; - margin: 5px 0 0 10px; -} - -/* forms */ -fieldset { - border: none; - margin: 0; - padding: 0; -} - - fieldset legend { - display: none; - } - - fieldset ol { - padding: 0; - list-style: none; - } - - fieldset ol li { - padding-bottom: 5px; - } - -label { - display: block; - font-size: 1.2em; - font-weight: 600; -} - - label.checkbox { - display: inline; - } - -input, select, textarea { - border: 1px solid #e2e2e2; - background: #fff; - color: #333; - font-size: 1.2em; - margin: 5px 0 6px 0; - padding: 5px; -} - -textarea { - font-family: inherit; - width: 500px; -} - - input:focus, textarea:focus { - border: 1px solid #7ac0da; - } - -input[type="checkbox"] { - background: transparent; - border: inherit; - width: auto; -} - -input[type="submit"], -input[type="button"], -button { - background-color: #d3dce0; - border: 1px solid #787878; - cursor: pointer; - font-size: 1.2em; - font-weight: 600; - padding: 7px; - margin-right: 8px; - width: auto; -} - -td input[type="submit"], -td input[type="button"], -td button { - font-size: 1em; - padding: 4px; - margin-right: 4px; -} - -/* info and errors */ -.message-info { - border: 1px solid; - clear: both; - padding: 10px 20px; -} - -.message-error { - clear: both; - color: #e80c4d; - font-size: 1.1em; - font-weight: bold; - margin: 20px 0 10px 0; -} - -.message-success { - color: #7ac0da; - font-size: 1.3em; - font-weight: bold; - margin: 20px 0 10px 0; -} - -.error { - color: #e80c4d; -} - -/* styles for validation helpers */ -.field-validation-error { - color: #e80c4d; - font-weight: bold; -} - -.field-validation-valid { - display: none; -} - -input.input-validation-error { - border: 1px solid #e80c4d; -} - -input[type="checkbox"].input-validation-error { - border: 0 none; -} - -.validation-summary-errors { - color: #e80c4d; - font-weight: bold; - font-size: 1.1em; -} - -.validation-summary-valid { - display: none; -} - - -/* tables -----------------------------------------------------------*/ -table { - border-collapse: collapse; - border-spacing: 0; - margin-top: 0.75em; - border: 0 none; -} - -th { - font-size: 1.2em; - text-align: left; - border: none 0px; - padding-right: 20px; -} - - th a { - display: block; - position: relative; - } - - th a:link, th a:visited, th a:active, th a:hover { - color: #333; - font-weight: 600; - text-decoration: none; - padding: 0; - } - - th a:hover { - color: #000; - } - - th.asc a, th.desc a { - margin-right: .75em; - } - - th.asc a:after, th.desc a:after { - display: block; - position: absolute; - right: 0em; - top: 0; - font-size: 0.75em; - } - - th.asc a:after { - content: '▲'; - } - - th.desc a:after { - content: '▼'; - } - -td { - padding: 0.25em 2em 0.25em 0em; - border: 0 none; -} - -tr.pager td { - padding: 0 0.25em 0 0; -} - - -/******************** -* Mobile Styles * -********************/ -@media only screen and (max-width: 850px) { - - /* header - ----------------------------------------------------------*/ - header .float-left, - header .float-right { - float: none; - } - - /* logo */ - header .site-title { - margin: 10px; - text-align: center; - } - - /* login */ - #login { - font-size: .85em; - margin: 0 0 12px; - text-align: center; - } - - #login ul { - margin: 5px 0; - padding: 0; - } - - #login li { - display: inline; - list-style: none; - margin: 0; - padding: 0; - } - - #login a { - background: none; - color: #999; - font-weight: 600; - margin: 2px; - padding: 0; - } - - #login a:hover { - color: #333; - } - - /* menu */ - nav { - margin-bottom: 5px; - } - - ul#menu { - margin: 0; - padding: 0; - text-align: center; - } - - ul#menu li { - margin: 0; - padding: 0; - } - - - /* main layout - ----------------------------------------------------------*/ - .main-content, - .featured + .main-content { - background-position: 10px 0; - } - - .content-wrapper { - padding-right: 10px; - padding-left: 10px; - } - - .featured .content-wrapper { - padding: 10px; - } - - /* page content */ - article, aside { - float: none; - width: 100%; - } - - /* ordered list */ - ol.round { - list-style-type: none; - padding-left: 0; - } - - ol.round li { - padding-left: 10px; - margin: 25px 0; - } - - ol.round li.zero, - ol.round li.one, - ol.round li.two, - ol.round li.three, - ol.round li.four, - ol.round li.five, - ol.round li.six, - ol.round li.seven, - ol.round li.eight, - ol.round li.nine { - background: none; - } - - /* features */ - section.feature { - float: none; - padding: 10px; - width: auto; - } - - section.feature img { - color: #999; - content: attr(alt); - font-size: 1.5em; - font-weight: 600; - } - - /* forms */ - input { - width: 90%; - } - - /* login page */ - #loginForm { - border-right: none; - float: none; - width: auto; - } - - #loginForm .validation-error { - display: block; - margin-left: 15px; - } - - #socialLoginForm { - margin-left: 0; - float: none; - width: auto; - } - - - /* footer - ----------------------------------------------------------*/ - footer .float-left, - footer .float-right { - float: none; - } - - footer { - text-align: center; - height: auto; - padding: 10px 0; - } - - footer p { - margin: 0; - } -} - -#queryexpression { - width: 700px; -} - -#countContainer { - margin-top: 20px; - margin-bottom: 20px; -} - -#countContainer label { - color: #333; - font-size: 1.2em; - font-weight: bold; - display: inline; -} - -#countContainer span { - margin-left: 50px; -} diff --git a/LinqToQuerystring.Demo/Controllers/HomeController.cs b/LinqToQuerystring.Demo/Controllers/HomeController.cs deleted file mode 100644 index 9d643a2..0000000 --- a/LinqToQuerystring.Demo/Controllers/HomeController.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace LinqToQuerystring.Demo.Controllers -{ - using System.Web.Mvc; - - public class HomeController : Controller - { - public ActionResult Index() - { - return View(); - } - } -} diff --git a/LinqToQuerystring.Demo/Controllers/ValuesController.cs b/LinqToQuerystring.Demo/Controllers/ValuesController.cs deleted file mode 100644 index d6b5fbf..0000000 --- a/LinqToQuerystring.Demo/Controllers/ValuesController.cs +++ /dev/null @@ -1,101 +0,0 @@ -namespace LinqToQuerystring.Demo.Controllers -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Web.Http; - - using LinqToQuerystring.Demo.Filters; - using LinqToQuerystring.Demo.Models; - using LinqToQuerystring.WebApi; - - public class ValuesController : ApiController - { - [ApiExceptionFilter] - [LinqToQueryable] - public IQueryable Get() - { - return - new List - { - new Movie - { - Title = "Matrix (The)", - ReleaseDate = new DateTime(1999, 3, 31), - DurationInMinutes = 136, - MetaScore = 73, - Director = "Andy Wachowski\\Lana Wachowski", - Recommended = true, - Tags = new List { "Sci Fi", "Action" }, - UserScores = new List { 73.5, 66.8, 87.3 } - }, - new Movie - { - Title = "Avatar", - ReleaseDate = new DateTime(2009, 12, 17), - DurationInMinutes = 162, - MetaScore = 83, - Director = "James Cameron", - Recommended = false, - Tags = new List { "Sci Fi", "Action" }, - UserScores = new List { 45.6, 72.0, 91.2, 83.12 } - }, - new Movie - { - Title = "Spaceballs", - ReleaseDate = new DateTime(1987, 6, 24), - DurationInMinutes = 96, - MetaScore = 46, - Director = "Mel Brooks", - Recommended = true, - Tags = new List { "Sci Fi", "Comedy" }, - UserScores = new List { 45.6, 32.0, 65.2 } - }, - new Movie - { - Title = "Return of the Jedi", - ReleaseDate = new DateTime(1983, 6, 2), - DurationInMinutes = 134, - MetaScore = 52, - Director = "Richard Marquand", - Recommended = true, - Tags = new List { "Sci Fi", "Epic" }, - UserScores = new List { 98, 87.9, 91.3, 97.5 } - }, - new Movie - { - Title = "Fellowship of the ring (The)", - ReleaseDate = new DateTime(2001, 12, 10), - DurationInMinutes = 228, - MetaScore = 92, - Director = "Peter Jackson", - Recommended = true, - Tags = new List { "Fantasy", "Epic" }, - UserScores = new List { 75.1, 66.5, 82, 86.3 } - }, - new Movie - { - Title = "There and Back Again, An Unexpected Journey", - ReleaseDate = new DateTime(2012, 12, 14), - DurationInMinutes = 169, - MetaScore = 58, - Director = "Peter Jackson", - Recommended = false, - Tags = new List { "Fantasy" }, - UserScores = new List { 55.1, 42.5, 39.8, 61.0 } - }, - new Movie - { - Title = "Ferris Bueller's Day Off", - ReleaseDate = new DateTime(2012, 6, 11), - DurationInMinutes = 103, - MetaScore = 60, - Director = "John Hughes", - Recommended = true, - Tags = new List { "Comedy" }, - UserScores = new List { 50.1, 63.6, 61, 73.9 } - } - }.AsQueryable(); - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Filters/ApiExceptionFilterAttribute.cs b/LinqToQuerystring.Demo/Filters/ApiExceptionFilterAttribute.cs deleted file mode 100644 index ccc9c33..0000000 --- a/LinqToQuerystring.Demo/Filters/ApiExceptionFilterAttribute.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace LinqToQuerystring.Demo.Filters -{ - using System; - using System.Net; - using System.Net.Http; - using System.Web.Http.Filters; - - public class ApiExceptionFilterAttribute : ExceptionFilterAttribute - { - public override void OnException(HttpActionExecutedContext actionExecutedContext) - { - var argumentException = actionExecutedContext.Exception as Exception; - if (argumentException != null) - { - var message = string.IsNullOrEmpty(argumentException.Message) - ? "An exception occurred" - : argumentException.Message; - - actionExecutedContext.Response = actionExecutedContext.Request.CreateErrorResponse(HttpStatusCode.BadRequest, message); - actionExecutedContext.Response.Content.Headers.ContentType = - actionExecutedContext.Request.Content.Headers.ContentType; - } - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Global.asax b/LinqToQuerystring.Demo/Global.asax deleted file mode 100644 index 0508998..0000000 --- a/LinqToQuerystring.Demo/Global.asax +++ /dev/null @@ -1 +0,0 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="LinqToQuerystring.Demo.WebApiApplication" Language="C#" %> diff --git a/LinqToQuerystring.Demo/Global.asax.cs b/LinqToQuerystring.Demo/Global.asax.cs deleted file mode 100644 index 11c7f0a..0000000 --- a/LinqToQuerystring.Demo/Global.asax.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Http; -using System.Web.Mvc; -using System.Web.Optimization; -using System.Web.Routing; - -namespace LinqToQuerystring.Demo -{ - // Note: For instructions on enabling IIS6 or IIS7 classic mode, - // visit http://go.microsoft.com/?LinkId=9394801 - - public class WebApiApplication : System.Web.HttpApplication - { - protected void Application_Start() - { - AreaRegistration.RegisterAllAreas(); - - WebApiConfig.Register(GlobalConfiguration.Configuration); - FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); - RouteConfig.RegisterRoutes(RouteTable.Routes); - BundleConfig.RegisterBundles(BundleTable.Bundles); - } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Images/accent.png b/LinqToQuerystring.Demo/Images/accent.png deleted file mode 100644 index cd07580..0000000 Binary files a/LinqToQuerystring.Demo/Images/accent.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/bullet.png b/LinqToQuerystring.Demo/Images/bullet.png deleted file mode 100644 index d3824c1..0000000 Binary files a/LinqToQuerystring.Demo/Images/bullet.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/heroAccent.png b/LinqToQuerystring.Demo/Images/heroAccent.png deleted file mode 100644 index 14ea59b..0000000 Binary files a/LinqToQuerystring.Demo/Images/heroAccent.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList0.png b/LinqToQuerystring.Demo/Images/orderedList0.png deleted file mode 100644 index 7a4ea25..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList0.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList1.png b/LinqToQuerystring.Demo/Images/orderedList1.png deleted file mode 100644 index 523c24d..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList1.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList2.png b/LinqToQuerystring.Demo/Images/orderedList2.png deleted file mode 100644 index 553a2da..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList2.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList3.png b/LinqToQuerystring.Demo/Images/orderedList3.png deleted file mode 100644 index 0714981..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList3.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList4.png b/LinqToQuerystring.Demo/Images/orderedList4.png deleted file mode 100644 index ce91e8f..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList4.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList5.png b/LinqToQuerystring.Demo/Images/orderedList5.png deleted file mode 100644 index c073485..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList5.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList6.png b/LinqToQuerystring.Demo/Images/orderedList6.png deleted file mode 100644 index 3b9aa05..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList6.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList7.png b/LinqToQuerystring.Demo/Images/orderedList7.png deleted file mode 100644 index f99c609..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList7.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList8.png b/LinqToQuerystring.Demo/Images/orderedList8.png deleted file mode 100644 index 127596d..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList8.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/Images/orderedList9.png b/LinqToQuerystring.Demo/Images/orderedList9.png deleted file mode 100644 index 39cfdcf..0000000 Binary files a/LinqToQuerystring.Demo/Images/orderedList9.png and /dev/null differ diff --git a/LinqToQuerystring.Demo/LinqToQuerystring.Demo.csproj b/LinqToQuerystring.Demo/LinqToQuerystring.Demo.csproj deleted file mode 100644 index d1804b5..0000000 --- a/LinqToQuerystring.Demo/LinqToQuerystring.Demo.csproj +++ /dev/null @@ -1,260 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {E6309DE6-1640-4E6F-9B47-B1E8890724FE} - {E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - LinqToQuerystring.Demo - LinqToQuerystring.Demo - v4.5 - false - true - - - - - ..\ - true - ..\packages\WebGrease.1.5.2\lib - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - False - ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll - - - - ..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - - ..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll - - - ..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.1\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll - - - ..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll - - - - ..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Extensions.dll - - - ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.Net.Http.2.2.15\lib\net45\System.Net.Http.Primitives.dll - - - - ..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll - - - - - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.OData.4.0.30506\lib\net40\System.Web.Http.OData.dll - - - False - ..\packages\Microsoft.AspNet.WebApi.Tracing.4.0.30506\lib\net40\System.Web.Http.Tracing.dll - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll - - - True - ..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll - - - False - ..\packages\Microsoft.AspNet.Web.Optimization.1.1.0\lib\net40\System.Web.Optimization.dll - - - True - ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll - - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll - - - True - ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll - - - - - ..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll - - - - - ..\packages\Microsoft.AspNet.Providers.Core.1.2\lib\net40\System.Web.Providers.dll - - - False - ..\packages\WebGrease.1.5.2\lib\WebGrease.dll - - - - - - - - - - - - Global.asax - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Web.config - - - Web.config - - - - - - - - - - - - - - - - - - - - - - - - - {ac211100-2f7a-46a9-b630-c2df57f50895} - LinqToQuerystring.WebApi - - - {7859C906-95D8-4322-AA44-BC854B065AEE} - LinqToQuerystring - - - - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - - - - True - True - 53540 - / - http://localhost:62981/ - False - False - - - False - - - - - - - - - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Models/Movie.cs b/LinqToQuerystring.Demo/Models/Movie.cs deleted file mode 100644 index 6bc79d2..0000000 --- a/LinqToQuerystring.Demo/Models/Movie.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace LinqToQuerystring.Demo.Models -{ - using System; - using System.Collections.Generic; - - public class Movie - { - public string Title { get; set; } - - public int DurationInMinutes { get; set; } - - public DateTime ReleaseDate { get; set; } - - public string Director { get; set; } - - public int MetaScore { get; set; } - - public bool Recommended { get; set; } - - public List Tags { get; set; } - - public List UserScores { get; set; } - } -} \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Properties/AssemblyInfo.cs b/LinqToQuerystring.Demo/Properties/AssemblyInfo.cs deleted file mode 100644 index e27ab74..0000000 --- a/LinqToQuerystring.Demo/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("LinqToQuerystring.Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LinqToQuerystring.Demo")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("71dcf2b6-920d-4683-b6f1-e92d7e851442")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - FTP.pubxml b/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - FTP.pubxml deleted file mode 100644 index 2e35979..0000000 --- a/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - FTP.pubxml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - FTP - Release - Any CPU - http://linqtoquerystring.azurewebsites.net - False - ftp://waws-prod-am2-001.ftp.azurewebsites.windows.net - False - True - site/wwwroot - linqtoquerystring\$linqtoquerystring - <_SavePWD>True - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - Web Deploy.pubxml b/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - Web Deploy.pubxml deleted file mode 100644 index 242172d..0000000 --- a/LinqToQuerystring.Demo/Properties/PublishProfiles/linqtoquerystring - Web Deploy.pubxml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - MSDeploy - Release - Any CPU - http://linqtoquerystring.azurewebsites.net - False - waws-prod-am2-001.publish.azurewebsites.windows.net:443 - linqtoquerystring - - True - WMSVC - True - $linqtoquerystring - <_SavePWD>True - - - - - - - - - - - - - - - - - - False - - - \ No newline at end of file diff --git a/LinqToQuerystring.Demo/Scripts/_references.js b/LinqToQuerystring.Demo/Scripts/_references.js deleted file mode 100644 index ad91314..0000000 --- a/LinqToQuerystring.Demo/Scripts/_references.js +++ /dev/null @@ -1,6 +0,0 @@ -/// -/// -/// -/// -/// -/// diff --git a/LinqToQuerystring.Demo/Scripts/jquery-1.10.1.js b/LinqToQuerystring.Demo/Scripts/jquery-1.10.1.js deleted file mode 100644 index 6f8c967..0000000 --- a/LinqToQuerystring.Demo/Scripts/jquery-1.10.1.js +++ /dev/null @@ -1,9807 +0,0 @@ -/*! - * jQuery JavaScript Library v1.10.1 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-05-30T21:49Z - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<10 - // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - location = window.location, - document = window.document, - docElem = document.documentElement, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.10.1", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - /* jshint eqeqeq: false */ - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - var key; - - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Support: IE<9 - // Handle iteration over inherited properties before own properties. - if ( jQuery.support.ownLast ) { - for ( key in obj ) { - return core_hasOwn.call( obj, key ); - } - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations. - // Note: this method belongs to the css module but it's needed here for the support module. - // If support gets modularized, this method should be moved back to the css module. - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -/*! - * Sizzle CSS Selector Engine v1.9.4-pre - * http://sizzlejs.com/ - * - * Copyright 2013 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-05-27 - */ -(function( window, undefined ) { - -var i, - support, - cachedruns, - Expr, - getText, - isXML, - compile, - outermostContext, - sortInput, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - hasDuplicate = false, - sortOrder = function() { return 0; }, - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rsibling = new RegExp( whitespace + "*[+~]" ), - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( documentIsHTML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // QSA path - if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - nid = old = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied if the test fails - * @param {Boolean} test The result of a test. If true, null will be set as the handler in leiu of the specified handler - */ -function addHandle( attrs, handler, test ) { - attrs = attrs.split("|"); - var current, - i = attrs.length, - setHandle = test ? null : handler; - - while ( i-- ) { - // Don't override a user's handler - if ( !(current = Expr.attrHandle[ attrs[i] ]) || current === handler ) { - Expr.attrHandle[ attrs[i] ] = setHandle; - } - } -} - -/** - * Fetches boolean attributes by node - * @param {Element} elem - * @param {String} name - */ -function boolHandler( elem, name ) { - // XML does not need to be checked as this will not be assigned for XML documents - var val = elem.getAttributeNode( name ); - return val && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; -} - -/** - * Fetches attributes without interpolation - * http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx - * @param {Element} elem - * @param {String} name - */ -function interpolationHandler( elem, name ) { - // XML does not need to be checked as this will not be assigned for XML documents - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); -} - -/** - * Uses defaultValue to retrieve value in IE6/7 - * @param {Element} elem - * @param {String} name - */ -function valueHandler( elem ) { - // Ignore the value *property* on inputs by using defaultValue - // Fallback to Sizzle.attr by returning undefined where appropriate - // XML does not need to be checked as this will not be assigned for XML documents - if ( elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns Returns -1 if a precedes b, 1 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - ( ~b.sourceIndex || MAX_NEGATIVE ) - - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc, - parent = doc.parentWindow; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsHTML = !isXML( doc ); - - // Support: IE>8 - // If iframe document is assigned to "document" variable and if iframe has been reloaded, - // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 - if ( parent && parent.frameElement ) { - parent.attachEvent( "onbeforeunload", function() { - setDocument(); - }); - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) - support.attributes = assert(function( div ) { - - // Support: IE<8 - // Prevent attribute/property "interpolation" - div.innerHTML = ""; - addHandle( "type|href|height|width", interpolationHandler, div.firstChild.getAttribute("href") === "#" ); - - // Support: IE<9 - // Use getAttributeNode to fetch booleans when getAttribute lies - addHandle( booleans, boolHandler, div.getAttribute("disabled") == null ); - - div.className = "i"; - return !div.getAttribute("className"); - }); - - // Support: IE<9 - // Retrieving value should defer to defaultValue - support.input = assert(function( div ) { - div.innerHTML = ""; - div.firstChild.setAttribute( "value", "" ); - return div.firstChild.getAttribute( "value" ) === ""; - }); - - // IE6/7 still return empty string for value, - // but are actually retrieving the property - addHandle( "value", valueHandler, support.attributes && support.input ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if getElementsByClassName can be trusted - support.getElementsByClassName = assert(function( div ) { - div.innerHTML = "
"; - - // Support: Safari<4 - // Catch class over-caching - div.firstChild.className = "i"; - // Support: Opera<10 - // Catch gEBCN failure to find non-leading classes - return div.getElementsByClassName("i").length === 2; - }); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( div ) { - docElem.appendChild( div ).id = expando; - return !doc.getElementsByName || !doc.getElementsByName( expando ).length; - }); - - // ID find and filter - if ( support.getById ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - // Support: IE6/7 - // getElementById is not reliable as a find shortcut - delete Expr.find["ID"]; - - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See http://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Support: Opera 10-12/IE8 - // ^= $= *= and empty values - // Should not select anything - // Support: Windows 8 Native Apps - // The type attribute is restricted during .innerHTML assignment - var input = doc.createElement("input"); - input.setAttribute( "type", "hidden" ); - div.appendChild( input ).setAttribute( "t", "" ); - - if ( div.querySelectorAll("[t^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = isNative( (matches = docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) - // Detached nodes confoundingly follow *each other* - support.sortDetached = assert(function( div1 ) { - // Should return 1, but returns 4 (following) - return div1.compareDocumentPosition( doc.createElement("div") ) & 1; - }); - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); - - if ( compare ) { - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === doc || contains(preferredDoc, a) ) { - return -1; - } - if ( b === doc || contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } - - // Not directly comparable, sort on existence of method - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return doc; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = ( fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined ); - - return val === undefined ? - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null : - val; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - !documentIsHTML, - results, - rsibling.test( selector ) - ); - return results; -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Initialize against the default document -setDocument(); - -// Support: Chrome<<14 -// Always assume duplicates if they aren't passed to the comparison function -[0, 0].sort( sortOrder ); -support.detectDuplicates = hasDuplicate; - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - firingLength = 0; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function( support ) { - - var all, a, input, select, fragment, opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
a"; - - // Finish early in limited (non-browser) environments - all = div.getElementsByTagName("*") || []; - a = div.getElementsByTagName("a")[ 0 ]; - if ( !a || !a.style || !all.length ) { - return support; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - support.getSetAttribute = div.className !== "t"; - - // IE strips leading whitespace when .innerHTML is used - support.leadingWhitespace = div.firstChild.nodeType === 3; - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - support.tbody = !div.getElementsByTagName("tbody").length; - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - support.htmlSerialize = !!div.getElementsByTagName("link").length; - - // Get the style information from getAttribute - // (IE uses .cssText instead) - support.style = /top/.test( a.getAttribute("style") ); - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - support.hrefNormalized = a.getAttribute("href") === "/a"; - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - support.opacity = /^0.5/.test( a.style.opacity ); - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - support.cssFloat = !!a.style.cssFloat; - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - support.checkOn = !!input.value; - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - support.optSelected = opt.selected; - - // Tests for enctype support on a form (#6743) - support.enctype = !!document.createElement("form").enctype; - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>"; - - // Will be defined later - support.inlineBlockNeedsLayout = false; - support.shrinkWrapBlocks = false; - support.pixelPosition = false; - support.deleteExpando = true; - support.noCloneEvent = true; - support.reliableMarginRight = true; - support.boxSizingReliable = true; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Support: IE<9 - // Iteration over object's inherited properties before its own. - for ( i in jQuery( support ) ) { - break; - } - support.ownLast = i !== "0"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "
t
"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior. - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - - // Workaround failing boxSizing test due to offsetWidth returning wrong value - // with some non-1 values of body zoom, ticket #13543 - jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { - support.boxSizing = div.offsetWidth === 4; - }); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "
"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})({}); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var ret, thisCache, - internalKey = jQuery.expando, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - // Avoid exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( typeof name === "string" ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - i = name.length; - while ( i-- ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - /* jshint eqeqeq: false */ - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - /* jshint eqeqeq: true */ - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "applet": true, - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - data = null, - i = 0, - elem = this[0]; - - // Special expections of .data basically thwart jQuery.access, - // so implement the relevant behavior ourselves - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( name.indexOf("data-") === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return arguments.length > 1 ? - - // Sets one value - this.each(function() { - jQuery.data( this, key, value ); - }) : - - // Gets one value - // Try to fetch any internally stored data first - elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n\f]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // Use proper attribute retrieval(#6932, #12072) - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { - optionSet = true; - } - } - - // force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.bool.test( name ) ) { - // Set corresponding property to false - if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - elem[ propName ] = false; - // Support: IE<9 - // Also clear defaultChecked/defaultSelected (if appropriate) - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? - ret : - ( elem[ name ] = value ); - - } else { - return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? - ret : - elem[ name ]; - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - return tabindex ? - parseInt( tabindex, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - -1; - } - } - } -}); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; - - jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? - function( elem, name, isXML ) { - var fn = jQuery.expr.attrHandle[ name ], - ret = isXML ? - undefined : - /* jshint eqeqeq: false */ - (jQuery.expr.attrHandle[ name ] = undefined) != - getter( elem, name, isXML ) ? - - name.toLowerCase() : - null; - jQuery.expr.attrHandle[ name ] = fn; - return ret; - } : - function( elem, name, isXML ) { - return isXML ? - undefined : - elem[ jQuery.camelCase( "default-" + name ) ] ? - name.toLowerCase() : - null; - }; -}); - -// fix oldIE attroperties -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = { - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = - // Some attributes are constructed with empty-string values when not defined - function( elem, name, isXML ) { - var ret; - return isXML ? - undefined : - (ret = elem.getAttributeNode( name )) && ret.value !== "" ? - ret.value : - null; - }; - jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ret.specified ? - ret.value : - undefined; - }, - set: nodeHook.set - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }; - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }; -} - -jQuery.each([ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -}); - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }; - if ( !jQuery.support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - // Support: Webkit - // "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - }; - } -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -var isSimple = /^.[^:#\[\.,]*$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, - ret = [], - self = this, - len = self.length; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = this.selector ? this.selector + " " + selector : selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); - }, - - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && (pos ? - pos.index(cur) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector(cur, selectors)) ) { - - cur = ret.push( cur ); - break; - } - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - if ( this.length > 1 ) { - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - ret = jQuery.unique( ret ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 && elem.nodeType === 1 ? - jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : - jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - })); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - /* jshint -W018 */ - return !!qualifier.call( elem, i, elem ) !== not; - }); - - } - - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - }); - - } - - if ( typeof qualifier === "string" ) { - if ( isSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - qualifier = jQuery.filter( qualifier, elements ); - } - - return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var - // Snapshot the DOM in case .domManip sweeps something relevant into its fragment - args = jQuery.map( this, function( elem ) { - return [ elem.nextSibling, elem.parentNode ]; - }), - i = 0; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - var next = args[ i++ ], - parent = args[ i++ ]; - - if ( parent ) { - // Don't use the snapshot next if it has moved (#13810) - if ( next && next.parentNode !== parent ) { - next = this.nextSibling; - } - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - // Allow new content to include elements from the context set - }, true ); - - // Force removal if there was no new content (e.g., from empty arguments) - return i ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback, allowIntersection ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback, allowIntersection ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery._evalUrl( node.src ); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - }, - - _evalUrl: function( url ) { - return jQuery.ajax({ - url: url, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } -}); -jQuery.fn.extend({ - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - var bool = typeof state === "boolean"; - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("' : ''); - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '
'; - var monthHtml = ''; - // month selection - if (secondary || !changeMonth) - monthHtml += '' + monthNames[drawMonth] + ''; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += ''; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); - // year selection - if ( !inst.yearshtml ) { - inst.yearshtml = ''; - if (secondary || !changeYear) - html += '' + drawYear + ''; - else { - // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ''; - - html += inst.yearshtml; - inst.yearshtml = null; - } - } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '
'; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') - this._notifyChange(inst); - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var newDate = (minDate && date < minDate ? minDate : date); - newDate = (maxDate && newDate > maxDate ? maxDate : newDate); - return newDate; - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day == 'object' ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); - } -}); - -/* - * Bind hover events for datepicker elements. - * Done via delegate so the binding only occurs once in the lifetime of the parent div. - * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. - */ -function bindHover(dpDiv) { - var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; - return dpDiv.bind('mouseout', function(event) { - var elem = $( event.target ).closest( selector ); - if ( !elem.length ) { - return; - } - elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); - }) - .bind('mouseover', function(event) { - var elem = $( event.target ).closest( selector ); - if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || - !elem.length ) { - return; - } - elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - elem.addClass('ui-state-hover'); - if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); - if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); - }); -} - -/* jQuery extend now ignores nulls! */ -function extendRemove(target, props) { - $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) - target[name] = props[name]; - return target; -}; - -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - -/* Invoke the datepicker functionality. - @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality - @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Verify an empty collection wasn't passed - Fixes #6976 */ - if ( !this.length ) { - return this; - } - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); - $.datepicker.initialized = true; - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.24"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; - -})(jQuery); - -(function( $, undefined ) { - -var uiDialogClasses = - 'ui-dialog ' + - 'ui-widget ' + - 'ui-widget-content ' + - 'ui-corner-all ', - sizeRelatedOptions = { - buttons: true, - height: true, - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true, - width: true - }, - resizableRelatedOptions = { - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true - }; - -$.widget("ui.dialog", { - options: { - autoOpen: true, - buttons: {}, - closeOnEscape: true, - closeText: 'close', - dialogClass: '', - draggable: true, - hide: null, - height: 'auto', - maxHeight: false, - maxWidth: false, - minHeight: 150, - minWidth: 150, - modal: false, - position: { - my: 'center', - at: 'center', - collision: 'fit', - // ensure that the titlebar is never outside the document - using: function(pos) { - var topOffset = $(this).css(pos).offset().top; - if (topOffset < 0) { - $(this).css('top', pos.top - topOffset); - } - } - }, - resizable: true, - show: null, - stack: true, - title: '', - width: 300, - zIndex: 1000 - }, - - _create: function() { - this.originalTitle = this.element.attr('title'); - // #5742 - .attr() might return a DOMElement - if ( typeof this.originalTitle !== "string" ) { - this.originalTitle = ""; - } - - this.options.title = this.options.title || this.originalTitle; - var self = this, - options = self.options, - - title = options.title || ' ', - titleId = $.ui.dialog.getTitleId(self.element), - - uiDialog = (self.uiDialog = $('
')) - .appendTo(document.body) - .hide() - .addClass(uiDialogClasses + options.dialogClass) - .css({ - zIndex: options.zIndex - }) - // setting tabIndex makes the div focusable - // setting outline to 0 prevents a border on focus in Mozilla - .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { - if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - self.close(event); - event.preventDefault(); - } - }) - .attr({ - role: 'dialog', - 'aria-labelledby': titleId - }) - .mousedown(function(event) { - self.moveToTop(false, event); - }), - - uiDialogContent = self.element - .show() - .removeAttr('title') - .addClass( - 'ui-dialog-content ' + - 'ui-widget-content') - .appendTo(uiDialog), - - uiDialogTitlebar = (self.uiDialogTitlebar = $('
')) - .addClass( - 'ui-dialog-titlebar ' + - 'ui-widget-header ' + - 'ui-corner-all ' + - 'ui-helper-clearfix' - ) - .prependTo(uiDialog), - - uiDialogTitlebarClose = $('') - .addClass( - 'ui-dialog-titlebar-close ' + - 'ui-corner-all' - ) - .attr('role', 'button') - .hover( - function() { - uiDialogTitlebarClose.addClass('ui-state-hover'); - }, - function() { - uiDialogTitlebarClose.removeClass('ui-state-hover'); - } - ) - .focus(function() { - uiDialogTitlebarClose.addClass('ui-state-focus'); - }) - .blur(function() { - uiDialogTitlebarClose.removeClass('ui-state-focus'); - }) - .click(function(event) { - self.close(event); - return false; - }) - .appendTo(uiDialogTitlebar), - - uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('')) - .addClass( - 'ui-icon ' + - 'ui-icon-closethick' - ) - .text(options.closeText) - .appendTo(uiDialogTitlebarClose), - - uiDialogTitle = $('') - .addClass('ui-dialog-title') - .attr('id', titleId) - .html(title) - .prependTo(uiDialogTitlebar); - - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { - options.beforeClose = options.beforeclose; - } - - uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); - - if (options.draggable && $.fn.draggable) { - self._makeDraggable(); - } - if (options.resizable && $.fn.resizable) { - self._makeResizable(); - } - - self._createButtons(options.buttons); - self._isOpen = false; - - if ($.fn.bgiframe) { - uiDialog.bgiframe(); - } - }, - - _init: function() { - if ( this.options.autoOpen ) { - this.open(); - } - }, - - destroy: function() { - var self = this; - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.hide(); - self.element - .unbind('.dialog') - .removeData('dialog') - .removeClass('ui-dialog-content ui-widget-content') - .hide().appendTo('body'); - self.uiDialog.remove(); - - if (self.originalTitle) { - self.element.attr('title', self.originalTitle); - } - - return self; - }, - - widget: function() { - return this.uiDialog; - }, - - close: function(event) { - var self = this, - maxZ, thisZ; - - if (false === self._trigger('beforeClose', event)) { - return; - } - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.unbind('keypress.ui-dialog'); - - self._isOpen = false; - - if (self.options.hide) { - self.uiDialog.hide(self.options.hide, function() { - self._trigger('close', event); - }); - } else { - self.uiDialog.hide(); - self._trigger('close', event); - } - - $.ui.dialog.overlay.resize(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - if (self.options.modal) { - maxZ = 0; - $('.ui-dialog').each(function() { - if (this !== self.uiDialog[0]) { - thisZ = $(this).css('z-index'); - if(!isNaN(thisZ)) { - maxZ = Math.max(maxZ, thisZ); - } - } - }); - $.ui.dialog.maxZ = maxZ; - } - - return self; - }, - - isOpen: function() { - return this._isOpen; - }, - - // the force parameter allows us to move modal dialogs to their correct - // position on open - moveToTop: function(force, event) { - var self = this, - options = self.options, - saveScroll; - - if ((options.modal && !force) || - (!options.stack && !options.modal)) { - return self._trigger('focus', event); - } - - if (options.zIndex > $.ui.dialog.maxZ) { - $.ui.dialog.maxZ = options.zIndex; - } - if (self.overlay) { - $.ui.dialog.maxZ += 1; - self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); - } - - //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. - // http://ui.jquery.com/bugs/ticket/3193 - saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() }; - $.ui.dialog.maxZ += 1; - self.uiDialog.css('z-index', $.ui.dialog.maxZ); - self.element.attr(saveScroll); - self._trigger('focus', event); - - return self; - }, - - open: function() { - if (this._isOpen) { return; } - - var self = this, - options = self.options, - uiDialog = self.uiDialog; - - self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; - self._size(); - self._position(options.position); - uiDialog.show(options.show); - self.moveToTop(true); - - // prevent tabbing out of modal dialogs - if ( options.modal ) { - uiDialog.bind( "keydown.ui-dialog", function( event ) { - if ( event.keyCode !== $.ui.keyCode.TAB ) { - return; - } - - var tabbables = $(':tabbable', this), - first = tabbables.filter(':first'), - last = tabbables.filter(':last'); - - if (event.target === last[0] && !event.shiftKey) { - first.focus(1); - return false; - } else if (event.target === first[0] && event.shiftKey) { - last.focus(1); - return false; - } - }); - } - - // set focus to the first tabbable element in the content area or the first button - // if there are no tabbable elements, set focus on the dialog itself - $(self.element.find(':tabbable').get().concat( - uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( - uiDialog.get()))).eq(0).focus(); - - self._isOpen = true; - self._trigger('open'); - - return self; - }, - - _createButtons: function(buttons) { - var self = this, - hasButtons = false, - uiDialogButtonPane = $('
') - .addClass( - 'ui-dialog-buttonpane ' + - 'ui-widget-content ' + - 'ui-helper-clearfix' - ), - uiButtonSet = $( "
" ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); - - // if we already have a button pane, remove it - self.uiDialog.find('.ui-dialog-buttonpane').remove(); - - if (typeof buttons === 'object' && buttons !== null) { - $.each(buttons, function() { - return !(hasButtons = true); - }); - } - if (hasButtons) { - $.each(buttons, function(name, props) { - props = $.isFunction( props ) ? - { click: props, text: name } : - props; - var button = $('') - .click(function() { - props.click.apply(self.element[0], arguments); - }) - .appendTo(uiButtonSet); - // can't use .attr( props, true ) with jQuery 1.3.2. - $.each( props, function( key, value ) { - if ( key === "click" ) { - return; - } - if ( key in button ) { - button[ key ]( value ); - } else { - button.attr( key, value ); - } - }); - if ($.fn.button) { - button.button(); - } - }); - uiDialogButtonPane.appendTo(self.uiDialog); - } - }, - - _makeDraggable: function() { - var self = this, - options = self.options, - doc = $(document), - heightBeforeDrag; - - function filteredUi(ui) { - return { - position: ui.position, - offset: ui.offset - }; - } - - self.uiDialog.draggable({ - cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', - handle: '.ui-dialog-titlebar', - containment: 'document', - start: function(event, ui) { - heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); - $(this).height($(this).height()).addClass("ui-dialog-dragging"); - self._trigger('dragStart', event, filteredUi(ui)); - }, - drag: function(event, ui) { - self._trigger('drag', event, filteredUi(ui)); - }, - stop: function(event, ui) { - options.position = [ui.position.left - doc.scrollLeft(), - ui.position.top - doc.scrollTop()]; - $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); - self._trigger('dragStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }); - }, - - _makeResizable: function(handles) { - handles = (handles === undefined ? this.options.resizable : handles); - var self = this, - options = self.options, - // .ui-resizable has position: relative defined in the stylesheet - // but dialogs have to use absolute or fixed positioning - position = self.uiDialog.css('position'), - resizeHandles = (typeof handles === 'string' ? - handles : - 'n,e,s,w,se,sw,ne,nw' - ); - - function filteredUi(ui) { - return { - originalPosition: ui.originalPosition, - originalSize: ui.originalSize, - position: ui.position, - size: ui.size - }; - } - - self.uiDialog.resizable({ - cancel: '.ui-dialog-content', - containment: 'document', - alsoResize: self.element, - maxWidth: options.maxWidth, - maxHeight: options.maxHeight, - minWidth: options.minWidth, - minHeight: self._minHeight(), - handles: resizeHandles, - start: function(event, ui) { - $(this).addClass("ui-dialog-resizing"); - self._trigger('resizeStart', event, filteredUi(ui)); - }, - resize: function(event, ui) { - self._trigger('resize', event, filteredUi(ui)); - }, - stop: function(event, ui) { - $(this).removeClass("ui-dialog-resizing"); - options.height = $(this).height(); - options.width = $(this).width(); - self._trigger('resizeStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }) - .css('position', position) - .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); - }, - - _minHeight: function() { - var options = this.options; - - if (options.height === 'auto') { - return options.minHeight; - } else { - return Math.min(options.minHeight, options.height); - } - }, - - _position: function(position) { - var myAt = [], - offset = [0, 0], - isVisible; - - if (position) { - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( - // if (typeof position == 'string' || $.isArray(position)) { - // myAt = $.isArray(position) ? position : position.split(' '); - - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length === 1) { - myAt[1] = myAt[0]; - } - - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] === myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; - } - }); - - position = { - my: myAt.join(" "), - at: myAt.join(" "), - offset: offset.join(" ") - }; - } - - position = $.extend({}, $.ui.dialog.prototype.options.position, position); - } else { - position = $.ui.dialog.prototype.options.position; - } - - // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is(':visible'); - if (!isVisible) { - this.uiDialog.show(); - } - this.uiDialog - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .position($.extend({ of: window }, position)); - if (!isVisible) { - this.uiDialog.hide(); - } - }, - - _setOptions: function( options ) { - var self = this, - resizableOptions = {}, - resize = false; - - $.each( options, function( key, value ) { - self._setOption( key, value ); - - if ( key in sizeRelatedOptions ) { - resize = true; - } - if ( key in resizableRelatedOptions ) { - resizableOptions[ key ] = value; - } - }); - - if ( resize ) { - this._size(); - } - if ( this.uiDialog.is( ":data(resizable)" ) ) { - this.uiDialog.resizable( "option", resizableOptions ); - } - }, - - _setOption: function(key, value){ - var self = this, - uiDialog = self.uiDialog; - - switch (key) { - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - case "beforeclose": - key = "beforeClose"; - break; - case "buttons": - self._createButtons(value); - break; - case "closeText": - // ensure that we always pass a string - self.uiDialogTitlebarCloseText.text("" + value); - break; - case "dialogClass": - uiDialog - .removeClass(self.options.dialogClass) - .addClass(uiDialogClasses + value); - break; - case "disabled": - if (value) { - uiDialog.addClass('ui-dialog-disabled'); - } else { - uiDialog.removeClass('ui-dialog-disabled'); - } - break; - case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); - if ( isDraggable && !value ) { - uiDialog.draggable( "destroy" ); - } - - if ( !isDraggable && value ) { - self._makeDraggable(); - } - break; - case "position": - self._position(value); - break; - case "resizable": - // currently resizable, becoming non-resizable - var isResizable = uiDialog.is( ":data(resizable)" ); - if (isResizable && !value) { - uiDialog.resizable('destroy'); - } - - // currently resizable, changing handles - if (isResizable && typeof value === 'string') { - uiDialog.resizable('option', 'handles', value); - } - - // currently non-resizable, becoming resizable - if (!isResizable && value !== false) { - self._makeResizable(value); - } - break; - case "title": - // convert whatever was passed in o a string, for html() to not throw up - $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); - break; - } - - $.Widget.prototype._setOption.apply(self, arguments); - }, - - _size: function() { - /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content - * divs will both have width and height set, so we need to reset them - */ - var options = this.options, - nonContentHeight, - minContentHeight, - isVisible = this.uiDialog.is( ":visible" ); - - // reset content sizing - this.element.show().css({ - width: 'auto', - minHeight: 0, - height: 0 - }); - - if (options.minWidth > options.width) { - options.width = options.minWidth; - } - - // reset wrapper sizing - // determine the height of all the non-content elements - nonContentHeight = this.uiDialog.css({ - height: 'auto', - width: options.width - }) - .height(); - minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); - - if ( options.height === "auto" ) { - // only needed for IE6 support - if ( $.support.minHeight ) { - this.element.css({ - minHeight: minContentHeight, - height: "auto" - }); - } else { - this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); - if ( !isVisible ) { - this.uiDialog.hide(); - } - this.element.height( Math.max( autoHeight, minContentHeight ) ); - } - } else { - this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); - } - - if (this.uiDialog.is(':data(resizable)')) { - this.uiDialog.resizable('option', 'minHeight', this._minHeight()); - } - } -}); - -$.extend($.ui.dialog, { - version: "1.8.24", - - uuid: 0, - maxZ: 0, - - getTitleId: function($el) { - var id = $el.attr('id'); - if (!id) { - this.uuid += 1; - id = this.uuid; - } - return 'ui-dialog-title-' + id; - }, - - overlay: function(dialog) { - this.$el = $.ui.dialog.overlay.create(dialog); - } -}); - -$.extend($.ui.dialog.overlay, { - instances: [], - // reuse old instances due to IE memory leak with alpha transparency (see #5185) - oldInstances: [], - maxZ: 0, - events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), - function(event) { return event + '.dialog-overlay'; }).join(' '), - create: function(dialog) { - if (this.instances.length === 0) { - // prevent use of anchors and inputs - // we use a setTimeout in case the overlay is created from an - // event that we're going to be cancelling (see #2804) - setTimeout(function() { - // handle $(el).dialog().dialog('close') (see #4065) - if ($.ui.dialog.overlay.instances.length) { - $(document).bind($.ui.dialog.overlay.events, function(event) { - // stop events if the z-index of the target is < the z-index of the overlay - // we cannot return true when we don't want to cancel the event (#3523) - if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { - return false; - } - }); - } - }, 1); - - // allow closing by pressing the escape key - $(document).bind('keydown.dialog-overlay', function(event) { - if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - dialog.close(event); - event.preventDefault(); - } - }); - - // handle window resize - $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); - } - - var $el = (this.oldInstances.pop() || $('
').addClass('ui-widget-overlay')) - .appendTo(document.body) - .css({ - width: this.width(), - height: this.height() - }); - - if ($.fn.bgiframe) { - $el.bgiframe(); - } - - this.instances.push($el); - return $el; - }, - - destroy: function($el) { - var indexOf = $.inArray($el, this.instances); - if (indexOf != -1){ - this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); - } - - if (this.instances.length === 0) { - $([document, window]).unbind('.dialog-overlay'); - } - - $el.remove(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - var maxZ = 0; - $.each(this.instances, function() { - maxZ = Math.max(maxZ, this.css('z-index')); - }); - this.maxZ = maxZ; - }, - - height: function() { - var scrollHeight, - offsetHeight; - // handle IE 6 - if ($.browser.msie && $.browser.version < 7) { - scrollHeight = Math.max( - document.documentElement.scrollHeight, - document.body.scrollHeight - ); - offsetHeight = Math.max( - document.documentElement.offsetHeight, - document.body.offsetHeight - ); - - if (scrollHeight < offsetHeight) { - return $(window).height() + 'px'; - } else { - return scrollHeight + 'px'; - } - // handle "good" browsers - } else { - return $(document).height() + 'px'; - } - }, - - width: function() { - var scrollWidth, - offsetWidth; - // handle IE - if ( $.browser.msie ) { - scrollWidth = Math.max( - document.documentElement.scrollWidth, - document.body.scrollWidth - ); - offsetWidth = Math.max( - document.documentElement.offsetWidth, - document.body.offsetWidth - ); - - if (scrollWidth < offsetWidth) { - return $(window).width() + 'px'; - } else { - return scrollWidth + 'px'; - } - // handle "good" browsers - } else { - return $(document).width() + 'px'; - } - }, - - resize: function() { - /* If the dialog is draggable and the user drags it past the - * right edge of the window, the document becomes wider so we - * need to stretch the overlay. If the user then drags the - * dialog back to the left, the document will become narrower, - * so we need to shrink the overlay to the appropriate size. - * This is handled by shrinking the overlay before setting it - * to the full document size. - */ - var $overlays = $([]); - $.each($.ui.dialog.overlay.instances, function() { - $overlays = $overlays.add(this); - }); - - $overlays.css({ - width: 0, - height: 0 - }).css({ - width: $.ui.dialog.overlay.width(), - height: $.ui.dialog.overlay.height() - }); - } -}); - -$.extend($.ui.dialog.overlay.prototype, { - destroy: function() { - $.ui.dialog.overlay.destroy(this.$el); - } -}); - -}(jQuery)); - -(function( $, undefined ) { - -$.ui = $.ui || {}; - -var horizontalPositions = /left|center|right/, - verticalPositions = /top|center|bottom/, - center = "center", - support = {}, - _position = $.fn.position, - _offset = $.fn.offset; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var target = $( options.of ), - targetElem = target[0], - collision = ( options.collision || "flip" ).split( " " ), - offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], - targetWidth, - targetHeight, - basePosition; - - if ( targetElem.nodeType === 9 ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: 0, left: 0 }; - // TODO: use $.isWindow() in 1.9 - } else if ( targetElem.setTimeout ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; - } else if ( targetElem.preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - targetWidth = targetHeight = 0; - basePosition = { top: options.of.pageY, left: options.of.pageX }; - } else { - targetWidth = target.outerWidth(); - targetHeight = target.outerHeight(); - basePosition = target.offset(); - } - - // force my and at to have valid horizontal and veritcal positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[this] || "" ).split( " " ); - if ( pos.length === 1) { - pos = horizontalPositions.test( pos[0] ) ? - pos.concat( [center] ) : - verticalPositions.test( pos[0] ) ? - [ center ].concat( pos ) : - [ center, center ]; - } - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; - options[ this ] = pos; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - // normalize offset option - offset[ 0 ] = parseInt( offset[0], 10 ) || 0; - if ( offset.length === 1 ) { - offset[ 1 ] = offset[ 0 ]; - } - offset[ 1 ] = parseInt( offset[1], 10 ) || 0; - - if ( options.at[0] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[0] === center ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[1] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[1] === center ) { - basePosition.top += targetHeight / 2; - } - - basePosition.left += offset[ 0 ]; - basePosition.top += offset[ 1 ]; - - return this.each(function() { - var elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, - marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, - collisionWidth = elemWidth + marginLeft + - ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ), - collisionHeight = elemHeight + marginTop + - ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), - position = $.extend( {}, basePosition ), - collisionPosition; - - if ( options.my[0] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[0] === center ) { - position.left -= elemWidth / 2; - } - - if ( options.my[1] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[1] === center ) { - position.top -= elemHeight / 2; - } - - // prevent fractions if jQuery version doesn't support them (see #5280) - if ( !support.fractions ) { - position.left = Math.round( position.left ); - position.top = Math.round( position.top ); - } - - collisionPosition = { - left: position.left - marginLeft, - top: position.top - marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[i] ] ) { - $.ui.position[ collision[i] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: offset, - my: options.my, - at: options.at - }); - } - }); - - if ( $.fn.bgiframe ) { - elem.bgiframe(); - } - elem.offset( $.extend( position, { using: options.using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); - position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); - }, - top: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); - position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); - } - }, - - flip: { - left: function( position, data ) { - if ( data.at[0] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - -data.targetWidth, - offset = -2 * data.offset[ 0 ]; - position.left += data.collisionPosition.left < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - }, - top: function( position, data ) { - if ( data.at[1] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), - myOffset = data.my[ 1 ] === "top" ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - -data.targetHeight, - offset = -2 * data.offset[ 1 ]; - position.top += data.collisionPosition.top < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - } - } -}; - -// offset setter from jQuery 1.4 -if ( !$.offset.setOffset ) { - $.offset.setOffset = function( elem, options ) { - // set position first, in-case top/left are set even on static elem - if ( /static/.test( $.curCSS( elem, "position" ) ) ) { - elem.style.position = "relative"; - } - var curElem = $( elem ), - curOffset = curElem.offset(), - curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0, - curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0, - props = { - top: (options.top - curOffset.top) + curTop, - left: (options.left - curOffset.left) + curLeft - }; - - if ( 'using' in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - }; - - $.fn.offset = function( options ) { - var elem = this[ 0 ]; - if ( !elem || !elem.ownerDocument ) { return null; } - if ( options ) { - if ( $.isFunction( options ) ) { - return this.each(function( i ) { - $( this ).offset( options.call( this, i, $( this ).offset() ) ); - }); - } - return this.each(function() { - $.offset.setOffset( this, options ); - }); - } - return _offset.call( this ); - }; -} - -// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css -if ( !$.curCSS ) { - $.curCSS = $.css; -} - -// fraction support test (older versions of jQuery don't support fractions) -(function () { - var body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ), - testElement, testElementParent, testElementStyle, offset, offsetTotal; - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( var i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;"; - - offset = $( div ).offset( function( _, offset ) { - return offset; - }).offset(); - - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); - - offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 ); - support.fractions = offsetTotal > 21 && offsetTotal < 22; -})(); - -}( jQuery )); - -(function( $, undefined ) { - -$.widget( "ui.progressbar", { - options: { - value: 0, - max: 100 - }, - - min: 0, - - _create: function() { - this.element - .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .attr({ - role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() - }); - - this.valueDiv = $( "
" ) - .appendTo( this.element ); - - this.oldValue = this._value(); - this._refreshValue(); - }, - - destroy: function() { - this.element - .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .removeAttr( "role" ) - .removeAttr( "aria-valuemin" ) - .removeAttr( "aria-valuemax" ) - .removeAttr( "aria-valuenow" ); - - this.valueDiv.remove(); - - $.Widget.prototype.destroy.apply( this, arguments ); - }, - - value: function( newValue ) { - if ( newValue === undefined ) { - return this._value(); - } - - this._setOption( "value", newValue ); - return this; - }, - - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; - } - return Math.min( this.options.max, Math.max( this.min, val ) ); - }, - - _percentage: function() { - return 100 * this._value() / this.options.max; - }, - - _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); - - if ( this.oldValue !== value ) { - this.oldValue = value; - this._trigger( "change" ); - } - - this.valueDiv - .toggle( value > this.min ) - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); - } -}); - -$.extend( $.ui.progressbar, { - version: "1.8.24" -}); - -})( jQuery ); - -(function( $, undefined ) { - -// number of pages in a slider -// (how many times can you page up/down to go through the whole range) -var numPages = 5; - -$.widget( "ui.slider", $.ui.mouse, { - - widgetEventPrefix: "slide", - - options: { - animate: false, - distance: 0, - max: 100, - min: 0, - orientation: "horizontal", - range: false, - step: 1, - value: 0, - values: null - }, - - _create: function() { - var self = this, - o = this.options, - existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), - handle = "", - handleCount = ( o.values && o.values.length ) || 1, - handles = []; - - this._keySliding = false; - this._mouseSliding = false; - this._animateOff = true; - this._handleIndex = null; - this._detectOrientation(); - this._mouseInit(); - - this.element - .addClass( "ui-slider" + - " ui-slider-" + this.orientation + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" + - ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); - - this.range = $([]); - - if ( o.range ) { - if ( o.range === true ) { - if ( !o.values ) { - o.values = [ this._valueMin(), this._valueMin() ]; - } - if ( o.values.length && o.values.length !== 2 ) { - o.values = [ o.values[0], o.values[0] ]; - } - } - - this.range = $( "
" ) - .appendTo( this.element ) - .addClass( "ui-slider-range" + - // note: this isn't the most fittingly semantic framework class for this element, - // but worked best visually with a variety of themes - " ui-widget-header" + - ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); - } - - for ( var i = existingHandles.length; i < handleCount; i += 1 ) { - handles.push( handle ); - } - - this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) ); - - this.handle = this.handles.eq( 0 ); - - this.handles.add( this.range ).filter( "a" ) - .click(function( event ) { - event.preventDefault(); - }) - .hover(function() { - if ( !o.disabled ) { - $( this ).addClass( "ui-state-hover" ); - } - }, function() { - $( this ).removeClass( "ui-state-hover" ); - }) - .focus(function() { - if ( !o.disabled ) { - $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); - $( this ).addClass( "ui-state-focus" ); - } else { - $( this ).blur(); - } - }) - .blur(function() { - $( this ).removeClass( "ui-state-focus" ); - }); - - this.handles.each(function( i ) { - $( this ).data( "index.ui-slider-handle", i ); - }); - - this.handles - .keydown(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ), - allowed, - curVal, - newVal, - step; - - if ( self.options.disabled ) { - return; - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - case $.ui.keyCode.END: - case $.ui.keyCode.PAGE_UP: - case $.ui.keyCode.PAGE_DOWN: - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - event.preventDefault(); - if ( !self._keySliding ) { - self._keySliding = true; - $( this ).addClass( "ui-state-active" ); - allowed = self._start( event, index ); - if ( allowed === false ) { - return; - } - } - break; - } - - step = self.options.step; - if ( self.options.values && self.options.values.length ) { - curVal = newVal = self.values( index ); - } else { - curVal = newVal = self.value(); - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - newVal = self._valueMin(); - break; - case $.ui.keyCode.END: - newVal = self._valueMax(); - break; - case $.ui.keyCode.PAGE_UP: - newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.PAGE_DOWN: - newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - if ( curVal === self._valueMax() ) { - return; - } - newVal = self._trimAlignValue( curVal + step ); - break; - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - if ( curVal === self._valueMin() ) { - return; - } - newVal = self._trimAlignValue( curVal - step ); - break; - } - - self._slide( event, index, newVal ); - }) - .keyup(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ); - - if ( self._keySliding ) { - self._keySliding = false; - self._stop( event, index ); - self._change( event, index ); - $( this ).removeClass( "ui-state-active" ); - } - - }); - - this._refreshValue(); - - this._animateOff = false; - }, - - destroy: function() { - this.handles.remove(); - this.range.remove(); - - this.element - .removeClass( "ui-slider" + - " ui-slider-horizontal" + - " ui-slider-vertical" + - " ui-slider-disabled" + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" ) - .removeData( "slider" ) - .unbind( ".slider" ); - - this._mouseDestroy(); - - return this; - }, - - _mouseCapture: function( event ) { - var o = this.options, - position, - normValue, - distance, - closestHandle, - self, - index, - allowed, - offset, - mouseOverHandle; - - if ( o.disabled ) { - return false; - } - - this.elementSize = { - width: this.element.outerWidth(), - height: this.element.outerHeight() - }; - this.elementOffset = this.element.offset(); - - position = { x: event.pageX, y: event.pageY }; - normValue = this._normValueFromMouse( position ); - distance = this._valueMax() - this._valueMin() + 1; - self = this; - this.handles.each(function( i ) { - var thisDistance = Math.abs( normValue - self.values(i) ); - if ( distance > thisDistance ) { - distance = thisDistance; - closestHandle = $( this ); - index = i; - } - }); - - // workaround for bug #3736 (if both handles of a range are at 0, - // the first is always used as the one with least distance, - // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { - index += 1; - closestHandle = $( this.handles[index] ); - } - - allowed = this._start( event, index ); - if ( allowed === false ) { - return false; - } - this._mouseSliding = true; - - self._handleIndex = index; - - closestHandle - .addClass( "ui-state-active" ) - .focus(); - - offset = closestHandle.offset(); - mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); - this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { - left: event.pageX - offset.left - ( closestHandle.width() / 2 ), - top: event.pageY - offset.top - - ( closestHandle.height() / 2 ) - - ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - - ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + - ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) - }; - - if ( !this.handles.hasClass( "ui-state-hover" ) ) { - this._slide( event, index, normValue ); - } - this._animateOff = true; - return true; - }, - - _mouseStart: function( event ) { - return true; - }, - - _mouseDrag: function( event ) { - var position = { x: event.pageX, y: event.pageY }, - normValue = this._normValueFromMouse( position ); - - this._slide( event, this._handleIndex, normValue ); - - return false; - }, - - _mouseStop: function( event ) { - this.handles.removeClass( "ui-state-active" ); - this._mouseSliding = false; - - this._stop( event, this._handleIndex ); - this._change( event, this._handleIndex ); - - this._handleIndex = null; - this._clickOffset = null; - this._animateOff = false; - - return false; - }, - - _detectOrientation: function() { - this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; - }, - - _normValueFromMouse: function( position ) { - var pixelTotal, - pixelMouse, - percentMouse, - valueTotal, - valueMouse; - - if ( this.orientation === "horizontal" ) { - pixelTotal = this.elementSize.width; - pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); - } else { - pixelTotal = this.elementSize.height; - pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); - } - - percentMouse = ( pixelMouse / pixelTotal ); - if ( percentMouse > 1 ) { - percentMouse = 1; - } - if ( percentMouse < 0 ) { - percentMouse = 0; - } - if ( this.orientation === "vertical" ) { - percentMouse = 1 - percentMouse; - } - - valueTotal = this._valueMax() - this._valueMin(); - valueMouse = this._valueMin() + percentMouse * valueTotal; - - return this._trimAlignValue( valueMouse ); - }, - - _start: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - return this._trigger( "start", event, uiHash ); - }, - - _slide: function( event, index, newVal ) { - var otherVal, - newValues, - allowed; - - if ( this.options.values && this.options.values.length ) { - otherVal = this.values( index ? 0 : 1 ); - - if ( ( this.options.values.length === 2 && this.options.range === true ) && - ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) - ) { - newVal = otherVal; - } - - if ( newVal !== this.values( index ) ) { - newValues = this.values(); - newValues[ index ] = newVal; - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal, - values: newValues - } ); - otherVal = this.values( index ? 0 : 1 ); - if ( allowed !== false ) { - this.values( index, newVal, true ); - } - } - } else { - if ( newVal !== this.value() ) { - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal - } ); - if ( allowed !== false ) { - this.value( newVal ); - } - } - } - }, - - _stop: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "stop", event, uiHash ); - }, - - _change: function( event, index ) { - if ( !this._keySliding && !this._mouseSliding ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "change", event, uiHash ); - } - }, - - value: function( newValue ) { - if ( arguments.length ) { - this.options.value = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, 0 ); - return; - } - - return this._value(); - }, - - values: function( index, newValue ) { - var vals, - newValues, - i; - - if ( arguments.length > 1 ) { - this.options.values[ index ] = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, index ); - return; - } - - if ( arguments.length ) { - if ( $.isArray( arguments[ 0 ] ) ) { - vals = this.options.values; - newValues = arguments[ 0 ]; - for ( i = 0; i < vals.length; i += 1 ) { - vals[ i ] = this._trimAlignValue( newValues[ i ] ); - this._change( null, i ); - } - this._refreshValue(); - } else { - if ( this.options.values && this.options.values.length ) { - return this._values( index ); - } else { - return this.value(); - } - } - } else { - return this._values(); - } - }, - - _setOption: function( key, value ) { - var i, - valsLength = 0; - - if ( $.isArray( this.options.values ) ) { - valsLength = this.options.values.length; - } - - $.Widget.prototype._setOption.apply( this, arguments ); - - switch ( key ) { - case "disabled": - if ( value ) { - this.handles.filter( ".ui-state-focus" ).blur(); - this.handles.removeClass( "ui-state-hover" ); - this.handles.propAttr( "disabled", true ); - this.element.addClass( "ui-disabled" ); - } else { - this.handles.propAttr( "disabled", false ); - this.element.removeClass( "ui-disabled" ); - } - break; - case "orientation": - this._detectOrientation(); - this.element - .removeClass( "ui-slider-horizontal ui-slider-vertical" ) - .addClass( "ui-slider-" + this.orientation ); - this._refreshValue(); - break; - case "value": - this._animateOff = true; - this._refreshValue(); - this._change( null, 0 ); - this._animateOff = false; - break; - case "values": - this._animateOff = true; - this._refreshValue(); - for ( i = 0; i < valsLength; i += 1 ) { - this._change( null, i ); - } - this._animateOff = false; - break; - } - }, - - //internal value getter - // _value() returns value trimmed by min and max, aligned by step - _value: function() { - var val = this.options.value; - val = this._trimAlignValue( val ); - - return val; - }, - - //internal values getter - // _values() returns array of values trimmed by min and max, aligned by step - // _values( index ) returns single value trimmed by min and max, aligned by step - _values: function( index ) { - var val, - vals, - i; - - if ( arguments.length ) { - val = this.options.values[ index ]; - val = this._trimAlignValue( val ); - - return val; - } else { - // .slice() creates a copy of the array - // this copy gets trimmed by min and max and then returned - vals = this.options.values.slice(); - for ( i = 0; i < vals.length; i+= 1) { - vals[ i ] = this._trimAlignValue( vals[ i ] ); - } - - return vals; - } - }, - - // returns the step-aligned value that val is closest to, between (inclusive) min and max - _trimAlignValue: function( val ) { - if ( val <= this._valueMin() ) { - return this._valueMin(); - } - if ( val >= this._valueMax() ) { - return this._valueMax(); - } - var step = ( this.options.step > 0 ) ? this.options.step : 1, - valModStep = (val - this._valueMin()) % step, - alignValue = val - valModStep; - - if ( Math.abs(valModStep) * 2 >= step ) { - alignValue += ( valModStep > 0 ) ? step : ( -step ); - } - - // Since JavaScript has problems with large floats, round - // the final value to 5 digits after the decimal point (see #4124) - return parseFloat( alignValue.toFixed(5) ); - }, - - _valueMin: function() { - return this.options.min; - }, - - _valueMax: function() { - return this.options.max; - }, - - _refreshValue: function() { - var oRange = this.options.range, - o = this.options, - self = this, - animate = ( !this._animateOff ) ? o.animate : false, - valPercent, - _set = {}, - lastValPercent, - value, - valueMin, - valueMax; - - if ( this.options.values && this.options.values.length ) { - this.handles.each(function( i, j ) { - valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - if ( self.options.range === true ) { - if ( self.orientation === "horizontal" ) { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } else { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - lastValPercent = valPercent; - }); - } else { - value = this.value(); - valueMin = this._valueMin(); - valueMax = this._valueMax(); - valPercent = ( valueMax !== valueMin ) ? - ( value - valueMin ) / ( valueMax - valueMin ) * 100 : - 0; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - - if ( oRange === "min" && this.orientation === "horizontal" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "horizontal" ) { - this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - if ( oRange === "min" && this.orientation === "vertical" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "vertical" ) { - this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - -}); - -$.extend( $.ui.slider, { - version: "1.8.24" -}); - -}(jQuery)); - -(function( $, undefined ) { - -var tabId = 0, - listId = 0; - -function getNextTabId() { - return ++tabId; -} - -function getNextListId() { - return ++listId; -} - -$.widget( "ui.tabs", { - options: { - add: null, - ajaxOptions: null, - cache: false, - cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } - collapsible: false, - disable: null, - disabled: [], - enable: null, - event: "click", - fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } - idPrefix: "ui-tabs-", - load: null, - panelTemplate: "
", - remove: null, - select: null, - show: null, - spinner: "Loading…", - tabTemplate: "
  • #{label}
  • " - }, - - _create: function() { - this._tabify( true ); - }, - - _setOption: function( key, value ) { - if ( key == "selected" ) { - if (this.options.collapsible && value == this.options.selected ) { - return; - } - this.select( value ); - } else { - this.options[ key ] = value; - this._tabify(); - } - }, - - _tabId: function( a ) { - return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || - this.options.idPrefix + getNextTabId(); - }, - - _sanitizeSelector: function( hash ) { - // we need this because an id may contain a ":" - return hash.replace( /:/g, "\\:" ); - }, - - _cookie: function() { - var cookie = this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); - return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); - }, - - _ui: function( tab, panel ) { - return { - tab: tab, - panel: panel, - index: this.anchors.index( tab ) - }; - }, - - _cleanup: function() { - // restore all former loading tabs labels - this.lis.filter( ".ui-state-processing" ) - .removeClass( "ui-state-processing" ) - .find( "span:data(label.tabs)" ) - .each(function() { - var el = $( this ); - el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); - }); - }, - - _tabify: function( init ) { - var self = this, - o = this.options, - fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash - - this.list = this.element.find( "ol,ul" ).eq( 0 ); - this.lis = $( " > li:has(a[href])", this.list ); - this.anchors = this.lis.map(function() { - return $( "a", this )[ 0 ]; - }); - this.panels = $( [] ); - - this.anchors.each(function( i, a ) { - var href = $( a ).attr( "href" ); - // For dynamically created HTML that contains a hash as href IE < 8 expands - // such href to the full page url with hash and then misinterprets tab as ajax. - // Same consideration applies for an added tab with a fragment identifier - // since a[href=#fragment-identifier] does unexpectedly not match. - // Thus normalize href attribute... - var hrefBase = href.split( "#" )[ 0 ], - baseEl; - if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || - ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { - href = a.hash; - a.href = href; - } - - // inline tab - if ( fragmentId.test( href ) ) { - self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); - // remote tab - // prevent loading the page itself if href is just "#" - } else if ( href && href !== "#" ) { - // required for restore on destroy - $.data( a, "href.tabs", href ); - - // TODO until #3808 is fixed strip fragment identifier from url - // (IE fails to load from such url) - $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); - - var id = self._tabId( a ); - a.href = "#" + id; - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) - .insertAfter( self.panels[ i - 1 ] || self.list ); - $panel.data( "destroy.tabs", true ); - } - self.panels = self.panels.add( $panel ); - // invalid tab href - } else { - o.disabled.push( i ); - } - }); - - // initialization from scratch - if ( init ) { - // attach necessary classes for styling - this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); - this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - this.lis.addClass( "ui-state-default ui-corner-top" ); - this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); - - // Selected tab - // use "selected" option or try to retrieve: - // 1. from fragment identifier in url - // 2. from cookie - // 3. from selected class attribute on
  • - if ( o.selected === undefined ) { - if ( location.hash ) { - this.anchors.each(function( i, a ) { - if ( a.hash == location.hash ) { - o.selected = i; - return false; - } - }); - } - if ( typeof o.selected !== "number" && o.cookie ) { - o.selected = parseInt( self._cookie(), 10 ); - } - if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - o.selected = o.selected || ( this.lis.length ? 0 : -1 ); - } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release - o.selected = -1; - } - - // sanity check - default to first tab... - o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) - ? o.selected - : 0; - - // Take disabling tabs via class attribute from HTML - // into account and update option properly. - // A selected tab cannot become disabled. - o.disabled = $.unique( o.disabled.concat( - $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { - return self.lis.index( n ); - }) - ) ).sort(); - - if ( $.inArray( o.selected, o.disabled ) != -1 ) { - o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); - } - - // highlight selected tab - this.panels.addClass( "ui-tabs-hide" ); - this.lis.removeClass( "ui-tabs-selected ui-state-active" ); - // check for length avoids error when initializing empty list - if ( o.selected >= 0 && this.anchors.length ) { - self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); - this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); - - // seems to be expected behavior that the show callback is fired - self.element.queue( "tabs", function() { - self._trigger( "show", null, - self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); - }); - - this.load( o.selected ); - } - - // clean up to avoid memory leaks in certain versions of IE 6 - // TODO: namespace this event - $( window ).bind( "unload", function() { - self.lis.add( self.anchors ).unbind( ".tabs" ); - self.lis = self.anchors = self.panels = null; - }); - // update selected after add/remove - } else { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - - // update collapsible - // TODO: use .toggleClass() - this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); - - // set or update cookie after init and add/remove respectively - if ( o.cookie ) { - this._cookie( o.selected, o.cookie ); - } - - // disable tabs - for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { - $( li )[ $.inArray( i, o.disabled ) != -1 && - // TODO: use .toggleClass() - !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); - } - - // reset cache if switching from cached to not cached - if ( o.cache === false ) { - this.anchors.removeData( "cache.tabs" ); - } - - // remove all handlers before, tabify may run on existing tabs after add or option change - this.lis.add( this.anchors ).unbind( ".tabs" ); - - if ( o.event !== "mouseover" ) { - var addState = function( state, el ) { - if ( el.is( ":not(.ui-state-disabled)" ) ) { - el.addClass( "ui-state-" + state ); - } - }; - var removeState = function( state, el ) { - el.removeClass( "ui-state-" + state ); - }; - this.lis.bind( "mouseover.tabs" , function() { - addState( "hover", $( this ) ); - }); - this.lis.bind( "mouseout.tabs", function() { - removeState( "hover", $( this ) ); - }); - this.anchors.bind( "focus.tabs", function() { - addState( "focus", $( this ).closest( "li" ) ); - }); - this.anchors.bind( "blur.tabs", function() { - removeState( "focus", $( this ).closest( "li" ) ); - }); - } - - // set up animations - var hideFx, showFx; - if ( o.fx ) { - if ( $.isArray( o.fx ) ) { - hideFx = o.fx[ 0 ]; - showFx = o.fx[ 1 ]; - } else { - hideFx = showFx = o.fx; - } - } - - // Reset certain styles left over from animation - // and prevent IE's ClearType bug... - function resetStyle( $el, fx ) { - $el.css( "display", "" ); - if ( !$.support.opacity && fx.opacity ) { - $el[ 0 ].style.removeAttribute( "filter" ); - } - } - - // Show a tab... - var showTab = showFx - ? function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way - .animate( showFx, showFx.duration || "normal", function() { - resetStyle( $show, showFx ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }); - } - : function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.removeClass( "ui-tabs-hide" ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }; - - // Hide a tab, $show is optional... - var hideTab = hideFx - ? function( clicked, $hide ) { - $hide.animate( hideFx, hideFx.duration || "normal", function() { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - resetStyle( $hide, hideFx ); - self.element.dequeue( "tabs" ); - }); - } - : function( clicked, $hide, $show ) { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - self.element.dequeue( "tabs" ); - }; - - // attach tab event handler, unbind to avoid duplicates from former tabifying... - this.anchors.bind( o.event + ".tabs", function() { - var el = this, - $li = $(el).closest( "li" ), - $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), - $show = self.element.find( self._sanitizeSelector( el.hash ) ); - - // If tab is already selected and not collapsible or tab disabled or - // or is already loading or click callback returns false stop here. - // Check if click handler returns false last so that it is not executed - // for a disabled or loading tab! - if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || - $li.hasClass( "ui-state-disabled" ) || - $li.hasClass( "ui-state-processing" ) || - self.panels.filter( ":animated" ).length || - self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { - this.blur(); - return false; - } - - o.selected = self.anchors.index( this ); - - self.abort(); - - // if tab may be closed - if ( o.collapsible ) { - if ( $li.hasClass( "ui-tabs-selected" ) ) { - o.selected = -1; - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }).dequeue( "tabs" ); - - this.blur(); - return false; - } else if ( !$hide.length ) { - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 - self.load( self.anchors.index( this ) ); - - this.blur(); - return false; - } - } - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - // show new tab - if ( $show.length ) { - if ( $hide.length ) { - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }); - } - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - self.load( self.anchors.index( this ) ); - } else { - throw "jQuery UI Tabs: Mismatching fragment identifier."; - } - - // Prevent IE from keeping other link focussed when using the back button - // and remove dotted border from clicked link. This is controlled via CSS - // in modern browsers; blur() removes focus from address bar in Firefox - // which can become a usability and annoying problem with tabs('rotate'). - if ( $.browser.msie ) { - this.blur(); - } - }); - - // disable click in any case - this.anchors.bind( "click.tabs", function(){ - return false; - }); - }, - - _getIndex: function( index ) { - // meta-function to give users option to provide a href string instead of a numerical index. - // also sanitizes numerical indexes to valid values. - if ( typeof index == "string" ) { - index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); - } - - return index; - }, - - destroy: function() { - var o = this.options; - - this.abort(); - - this.element - .unbind( ".tabs" ) - .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) - .removeData( "tabs" ); - - this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - - this.anchors.each(function() { - var href = $.data( this, "href.tabs" ); - if ( href ) { - this.href = href; - } - var $this = $( this ).unbind( ".tabs" ); - $.each( [ "href", "load", "cache" ], function( i, prefix ) { - $this.removeData( prefix + ".tabs" ); - }); - }); - - this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { - if ( $.data( this, "destroy.tabs" ) ) { - $( this ).remove(); - } else { - $( this ).removeClass([ - "ui-state-default", - "ui-corner-top", - "ui-tabs-selected", - "ui-state-active", - "ui-state-hover", - "ui-state-focus", - "ui-state-disabled", - "ui-tabs-panel", - "ui-widget-content", - "ui-corner-bottom", - "ui-tabs-hide" - ].join( " " ) ); - } - }); - - if ( o.cookie ) { - this._cookie( null, o.cookie ); - } - - return this; - }, - - add: function( url, label, index ) { - if ( index === undefined ) { - index = this.anchors.length; - } - - var self = this, - o = this.options, - $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), - id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); - - $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); - - // try to find an existing element before creating a new one - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .data( "destroy.tabs", true ); - } - $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); - - if ( index >= this.lis.length ) { - $li.appendTo( this.list ); - $panel.appendTo( this.list[ 0 ].parentNode ); - } else { - $li.insertBefore( this.lis[ index ] ); - $panel.insertBefore( this.panels[ index ] ); - } - - o.disabled = $.map( o.disabled, function( n, i ) { - return n >= index ? ++n : n; - }); - - this._tabify(); - - if ( this.anchors.length == 1 ) { - o.selected = 0; - $li.addClass( "ui-tabs-selected ui-state-active" ); - $panel.removeClass( "ui-tabs-hide" ); - this.element.queue( "tabs", function() { - self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); - }); - - this.load( 0 ); - } - - this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - remove: function( index ) { - index = this._getIndex( index ); - var o = this.options, - $li = this.lis.eq( index ).remove(), - $panel = this.panels.eq( index ).remove(); - - // If selected tab was removed focus tab to the right or - // in case the last tab was removed the tab to the left. - if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { - this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); - } - - o.disabled = $.map( - $.grep( o.disabled, function(n, i) { - return n != index; - }), - function( n, i ) { - return n >= index ? --n : n; - }); - - this._tabify(); - - this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); - return this; - }, - - enable: function( index ) { - index = this._getIndex( index ); - var o = this.options; - if ( $.inArray( index, o.disabled ) == -1 ) { - return; - } - - this.lis.eq( index ).removeClass( "ui-state-disabled" ); - o.disabled = $.grep( o.disabled, function( n, i ) { - return n != index; - }); - - this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - disable: function( index ) { - index = this._getIndex( index ); - var self = this, o = this.options; - // cannot disable already selected tab - if ( index != o.selected ) { - this.lis.eq( index ).addClass( "ui-state-disabled" ); - - o.disabled.push( index ); - o.disabled.sort(); - - this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - } - - return this; - }, - - select: function( index ) { - index = this._getIndex( index ); - if ( index == -1 ) { - if ( this.options.collapsible && this.options.selected != -1 ) { - index = this.options.selected; - } else { - return this; - } - } - this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); - return this; - }, - - load: function( index ) { - index = this._getIndex( index ); - var self = this, - o = this.options, - a = this.anchors.eq( index )[ 0 ], - url = $.data( a, "load.tabs" ); - - this.abort(); - - // not remote or from cache - if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { - this.element.dequeue( "tabs" ); - return; - } - - // load remote from here on - this.lis.eq( index ).addClass( "ui-state-processing" ); - - if ( o.spinner ) { - var span = $( "span", a ); - span.data( "label.tabs", span.html() ).html( o.spinner ); - } - - this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { - url: url, - success: function( r, s ) { - self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); - - // take care of tab labels - self._cleanup(); - - if ( o.cache ) { - $.data( a, "cache.tabs", true ); - } - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - o.ajaxOptions.success( r, s ); - } - catch ( e ) {} - }, - error: function( xhr, s, e ) { - // take care of tab labels - self._cleanup(); - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - // Passing index avoid a race condition when this method is - // called after the user has selected another tab. - // Pass the anchor that initiated this request allows - // loadError to manipulate the tab content panel via $(a.hash) - o.ajaxOptions.error( xhr, s, index, a ); - } - catch ( e ) {} - } - } ) ); - - // last, so that load event is fired before show... - self.element.dequeue( "tabs" ); - - return this; - }, - - abort: function() { - // stop possibly running animations - this.element.queue( [] ); - this.panels.stop( false, true ); - - // "tabs" queue must not contain more than two elements, - // which are the callbacks for the latest clicked tab... - this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); - - // terminate pending requests from other tabs - if ( this.xhr ) { - this.xhr.abort(); - delete this.xhr; - } - - // take care of tab labels - this._cleanup(); - return this; - }, - - url: function( index, url ) { - this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); - return this; - }, - - length: function() { - return this.anchors.length; - } -}); - -$.extend( $.ui.tabs, { - version: "1.8.24" -}); - -/* - * Tabs Extensions - */ - -/* - * Rotate - */ -$.extend( $.ui.tabs.prototype, { - rotation: null, - rotate: function( ms, continuing ) { - var self = this, - o = this.options; - - var rotate = self._rotate || ( self._rotate = function( e ) { - clearTimeout( self.rotation ); - self.rotation = setTimeout(function() { - var t = o.selected; - self.select( ++t < self.anchors.length ? t : 0 ); - }, ms ); - - if ( e ) { - e.stopPropagation(); - } - }); - - var stop = self._unrotate || ( self._unrotate = !continuing - ? function(e) { - if (e.clientX) { // in case of a true click - self.rotate(null); - } - } - : function( e ) { - rotate(); - }); - - // start rotation - if ( ms ) { - this.element.bind( "tabsshow", rotate ); - this.anchors.bind( o.event + ".tabs", stop ); - rotate(); - // stop rotation - } else { - clearTimeout( self.rotation ); - this.element.unbind( "tabsshow", rotate ); - this.anchors.unbind( o.event + ".tabs", stop ); - delete this._rotate; - delete this._unrotate; - } - - return this; - } -}); - -})( jQuery ); diff --git a/LinqToQuerystring.Demo/Scripts/jquery-ui-1.8.24.min.js b/LinqToQuerystring.Demo/Scripts/jquery-ui-1.8.24.min.js deleted file mode 100644 index 9278857..0000000 --- a/LinqToQuerystring.Demo/Scripts/jquery-ui-1.8.24.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! jQuery UI - v1.8.24 - 2012-09-28 -* https://github.com/jquery/jquery-ui -* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js, jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js, jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js, jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js, jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js, jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tabs.js -* Copyright (c) 2012 AUTHORS.txt; Licensed MIT */ -(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.24",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})}(jQuery),function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
    ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f=k&&g<=l||h>=k&&h<=l||gl)&&(e>=i&&e<=j||f>=i&&f<=j||ej);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),ea.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.24"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}}(jQuery),function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("
    ")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.righth||i.bottome&&i.rightf&&i.bottom *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(f.instance!==this.currentContainer)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+jf&&b+ka[this.floating?"width":"height"]?l:f0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.leftthis.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.topthis.containment[3]?h-this.offset.click.topthis.containment[2]?i-this.offset.click.left=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}});var m={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,b){m[b]=function(b){return Math.pow(b,a+2)}}),a.extend(m,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return a===0||a===1?a:-Math.pow(2,8*(a-1))*Math.sin(((a-1)*80-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){var b,c=4;while(a<((b=Math.pow(2,--c))-1)/11);return 1/Math.pow(4,3-c)-7.5625*Math.pow((b*3-2)/22-a,2)}}),a.each(m,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return a<.5?c(a*2)/2:c(a*-2+2)/-2+1}})}(jQuery),function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight(!0)/3:c.outerWidth(!0)/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}}(jQuery),function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.24",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})}(jQuery),function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("
      ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length
    • ").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})}(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})}(jQuery),function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('
      '))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.24"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
      ')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id.replace(/\\\\/g,"\\");a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'",x=d?'
      '+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
      ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
      '+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
      '+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
      '+this._get(a,"weekHeader")+"
      '+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?" ":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
      "+(j?""+(g[0]>0&&N==g[1]-1?'
      ':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='
      ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
      ",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.24",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
      ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
      ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),f=a("
      ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(f);a.each(d,function(a,b){if(a==="click")return;a in e?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.24",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),a.curCSS||(a.curCSS=a.css),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()}(jQuery),function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
      ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.24"})}(jQuery),function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("
      ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.24"})}(jQuery),function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
      ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
    • #{label}
    • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.24"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a