This repository has been archived by the owner on Jun 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RegionalSettings implementation, #649
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { SharePointQueryable, SharePointQueryableInstance, SharePointQueryableCollection } from "./sharepointqueryable"; | ||
|
||
/** | ||
* Describes regional settings ODada object | ||
*/ | ||
export class RegionalSettings extends SharePointQueryableInstance { | ||
|
||
/** | ||
* Creates a new instance of the RegionalSettings class | ||
* | ||
* @param baseUrl The url or SharePointQueryable which forms the parent of this regional settings collection | ||
*/ | ||
|
||
constructor(baseUrl: string | SharePointQueryable, path = "regionalsettings") { | ||
super(baseUrl, path); | ||
} | ||
|
||
/** | ||
* Gets installed languages | ||
*/ | ||
public get installedLanguages(): InstalledLanguages { | ||
return new InstalledLanguages(this); | ||
} | ||
|
||
/** | ||
* Gets time zone | ||
*/ | ||
public get timeZone(): TimeZone { | ||
return new TimeZone(this); | ||
} | ||
|
||
/** | ||
* Gets time zones | ||
*/ | ||
public get timeZones(): TimeZones { | ||
return new TimeZones(this); | ||
} | ||
|
||
} | ||
|
||
export interface RegionalSettingsProps { | ||
AdjustHijriDays: number; | ||
AlternateCalendarType: number; | ||
AM: string; | ||
CalendarType: number; | ||
Collation: number; | ||
CollationLCID: number; | ||
DateFormat: number; | ||
DateSeparator: string; | ||
DecimalSeparator: string; | ||
DigitGrouping: string; | ||
FirstDayOfWeek: number; | ||
FirstWeekOfYear: number; | ||
IsEastAsia: boolean; | ||
IsRightToLeft: boolean; | ||
IsUIRightToLeft: boolean; | ||
ListSeparator: string; | ||
LocaleId: number; | ||
NegativeSign: string; | ||
NegNumberMode: number; | ||
PM: string; | ||
PositiveSign: string; | ||
ShowWeeks: boolean; | ||
ThousandSeparator: string; | ||
Time24: boolean; | ||
TimeMarkerPosition: number; | ||
TimeSeparator: string; | ||
WorkDayEndHour: number; | ||
WorkDays: number; | ||
WorkDayStartHour: number; | ||
} | ||
|
||
/** | ||
* Describes TimeZone ODada object | ||
*/ | ||
export class TimeZone extends SharePointQueryableInstance { | ||
constructor(baseUrl: string | SharePointQueryable, path = "timezone") { | ||
super(baseUrl, path); | ||
} | ||
} | ||
|
||
/** | ||
* Describes installed languages ODada queriable collection | ||
*/ | ||
export class InstalledLanguages extends SharePointQueryableInstance { | ||
constructor(baseUrl: string | SharePointQueryable, path = "installedlanguages") { | ||
super(baseUrl, path); | ||
} | ||
} | ||
|
||
/** | ||
* Describes time zones queriable collection | ||
*/ | ||
export class TimeZones extends SharePointQueryableCollection { | ||
constructor(baseUrl: string | SharePointQueryable, path = "timezones") { | ||
super(baseUrl, path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { expect } from "chai"; | ||
import { RegionalSettings } from "../../src/sharepoint/regionalsettings"; | ||
import { toMatchEndRegex } from "../testutils"; | ||
|
||
describe("RegionalSettings", () => { | ||
|
||
let regionalsettings: RegionalSettings; | ||
|
||
beforeEach(() => { | ||
regionalsettings = new RegionalSettings("_api/web"); | ||
}); | ||
|
||
it("Should be an object", () => { | ||
expect(regionalsettings).to.be.a("object"); | ||
}); | ||
|
||
describe("url", () => { | ||
it("Should return _api/web/regionalsettings", () => { | ||
expect(regionalsettings.toUrl()).to.match(toMatchEndRegex("_api/web/regionalsettings")); | ||
}); | ||
}); | ||
|
||
describe("installedLanguages", () => { | ||
it("Should return _api/web/regionalsettings/installedlanguages", () => { | ||
expect(regionalsettings.installedLanguages.toUrl()).to.match(toMatchEndRegex("_api/web/regionalsettings/installedlanguages")); | ||
}); | ||
}); | ||
|
||
describe("timeZone", () => { | ||
it("Should return _api/web/regionalsettings/timezone", () => { | ||
expect(regionalsettings.timeZone.toUrl()).to.match(toMatchEndRegex("_api/web/regionalsettings/timezone")); | ||
}); | ||
}); | ||
|
||
describe("timeZones", () => { | ||
it("Should return _api/web/regionalsettings/timezones", () => { | ||
expect(regionalsettings.timeZones.toUrl()).to.match(toMatchEndRegex("_api/web/regionalsettings/timezones")); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters