當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript users.Users類代碼示例

本文整理匯總了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;未經允許,請勿轉載。