-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): add new Chat UI components set
- Loading branch information
Showing
38 changed files
with
2,526 additions
and
7 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,77 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { browser, element, by } from 'protractor'; | ||
import { colors, chatSizes as sizes } from './component-shared'; | ||
import { waitFor } from './e2e-helper'; | ||
|
||
let chats: any[] = []; | ||
|
||
function prepareChats() { | ||
const result: any[] = []; | ||
|
||
let elementNumber: number = 1; | ||
for (const { colorKey, color } of colors) { | ||
for (const { sizeKey, height } of sizes) { | ||
result.push({ | ||
size: sizeKey, | ||
height: height, | ||
colorKey, | ||
color, | ||
elementNumber, | ||
}); | ||
elementNumber++; | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
describe('nb-chat', () => { | ||
|
||
chats = prepareChats(); | ||
|
||
beforeEach((done) => { | ||
browser.get('#/chat/chat-test.component').then(() => done()); | ||
}); | ||
|
||
chats.forEach(c => { | ||
|
||
it(`should display ${c.colorKey} chat with ${c.size} size`, () => { | ||
waitFor(`nb-chat:nth-child(${c.elementNumber})`); | ||
|
||
element(by.css(`nb-chat:nth-child(${c.elementNumber})`)).getCssValue('height').then(height => { | ||
expect(height).toEqual(c.height); | ||
}); | ||
|
||
element(by.css(`nb-chat:nth-child(${c.elementNumber}) .header`)) | ||
.getCssValue('background-color').then(bgColor => { | ||
expect(bgColor).toEqual(c.color); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should add on message', () => { | ||
const all: any = element.all(by.css('nb-chat:nth-child(1) nb-chat-message')); | ||
all.count().then(allCount => { | ||
element(by.css('nb-chat:nth-child(1) nb-chat-form input')).sendKeys('akveo'); | ||
element(by.css('nb-chat:nth-child(1) nb-chat-form .btn')).click(); | ||
expect(all.count()).toEqual(allCount + 1); | ||
}); | ||
}); | ||
|
||
it('should not add on an empty message', () => { | ||
const all: any = element.all(by.css('nb-chat:nth-child(1) nb-chat-message')); | ||
all.count().then(allCount => { | ||
element(by.css('nb-chat:nth-child(1) nb-chat-form .btn')).click(); | ||
expect(all.count()).toEqual(allCount); | ||
|
||
element(by.css('nb-chat:nth-child(1) nb-chat-form input')).sendKeys(' '); | ||
element(by.css('nb-chat:nth-child(1) nb-chat-form .btn')).click(); | ||
expect(all.count()).toEqual(allCount); | ||
}); | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.