本文整理汇总了TypeScript中models/users/users.Users类的典型用法代码示例。如果您正苦于以下问题:TypeScript Users类的具体用法?TypeScript Users怎么用?TypeScript Users使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Users类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: allUsers
function allUsers() {
const bob = new User({
login_name: "bob",
display_name: "",
is_admin: true,
roles: [{name: "gocd-admins", type: "gocd"}],
});
const joe = new User({
login_name: "joe",
display_name: "",
is_admin: true,
roles: [{name: "nobody", type: "gocd"}]
});
const alice = new User({
login_name: "alice",
display_name: "",
is_admin: true,
roles: [{name: "gocd-admins", type: "gocd"}]
});
const users = new Users(bob, alice, joe);
users.map((user) => {
user.checked(true);
});
return users;
}
开发者ID:GaneshSPatil,项目名称:gocd,代码行数:27,代码来源:role_selection_spec.ts
示例2: it
it("should remove user by username", () => {
const users = Users.fromJSON(usersJSON());
const user = Users.fromJSON(usersJSON())[2];
user.displayName("Testing replace");
const originalUser = users[2];
users.replace(user);
// not the same object
expect(originalUser).not.toEqual(users[2]);
expect(user).toEqual(users[2]);
});
开发者ID:GaneshSPatil,项目名称:gocd,代码行数:11,代码来源:users_spec.ts
示例3: it
it("should return all users when no search query is provided", () => {
const users = Users.fromJSON(usersJSON());
const userFilters = new UserFilters();
const filteredUsers = userFilters.performFilteringOn(users);
expect(filteredUsers.totalUsersCount()).toBe(7);
expect(userFilters.searchText()).toBe("");
});
开发者ID:GaneshSPatil,项目名称:gocd,代码行数:7,代码来源:user_filters_spec.ts
示例4: if
rolesSelection.forEach((value, key) => {
if (value.ischanged() && value.isUnchecked()) {
operations.push({
role: key.name(),
users: {
remove: users.userNamesOfSelectedUsers()
}
});
} else if (value.ischanged() && value.isChecked()) {
operations.push({
role: key.name(),
users: {
add: users.userNamesOfSelectedUsers()
}
});
}
});
开发者ID:Skarlso,项目名称:gocd,代码行数:17,代码来源:role_selection.ts
示例5: it
it("should tell if any user is selected", () => {
const users = Users.fromJSON(usersJSON());
expect(users.anyUserSelected()).toBe(false);
users[0].checked(true);
expect(users.anyUserSelected()).toBe(true);
});
开发者ID:Skarlso,项目名称:gocd,代码行数:8,代码来源:users_spec.ts
注:本文中的models/users/users.Users类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论