-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'origin/master' into 134371/NAS-134371
- Loading branch information
Showing
195 changed files
with
8,257 additions
and
6,606 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
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
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 was deleted.
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
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
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
11 changes: 11 additions & 0 deletions
11
...ules/ix-table/components/ix-table-body/cells/ix-cell-checkbox/ix-cell-checkbox.harness.ts
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,11 @@ | ||
import { ContentContainerComponentHarness } from '@angular/cdk/testing'; | ||
import { MatCheckboxHarness } from '@angular/material/checkbox/testing'; | ||
|
||
export class IxCellCheckboxHarness extends ContentContainerComponentHarness { | ||
static readonly hostSelector = 'ix-cell-checkbox'; | ||
|
||
async check(): Promise<void> { | ||
const checkbox = await this.getHarness(MatCheckboxHarness); | ||
await checkbox.check(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import { ContentContainerComponentHarness } from '@angular/cdk/testing'; | ||
import { | ||
IxCellCheckboxHarness, | ||
} from 'app/modules/ix-table/components/ix-table-body/cells/ix-cell-checkbox/ix-cell-checkbox.harness'; | ||
|
||
export class IxRowHarness extends ContentContainerComponentHarness { | ||
static readonly hostSelector = '.row'; | ||
|
||
async check(): Promise<void> { | ||
const checkbox = await this.getHarness(IxCellCheckboxHarness); | ||
await checkbox.check(); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/app/modules/use-enterprise-marketing-link/use-enterprise-marketing-link.component.html
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,13 @@ | ||
<a | ||
ixTest="use-enterprise-marketing-link" | ||
target="_blank" | ||
[href]="currentMessageHref()" | ||
> | ||
<span class="text-above"> | ||
{{ currentMessage() }} | ||
</span> | ||
|
||
<span class="text-below"> | ||
{{ 'Explore TrueNAS Enterprise' | translate }} | ||
</span> | ||
</a> |
23 changes: 23 additions & 0 deletions
23
src/app/modules/use-enterprise-marketing-link/use-enterprise-marketing-link.component.scss
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,23 @@ | ||
@import 'scss-imports/variables'; | ||
|
||
:host { | ||
margin: 0 auto 5px; | ||
} | ||
|
||
a { | ||
cursor: pointer; | ||
display: block; | ||
margin-bottom: 2px; | ||
text-align: center; | ||
text-decoration: none; | ||
|
||
span { | ||
color: var(--primary-txt); | ||
display: block; | ||
|
||
&.text-above { | ||
color: var(--primary); | ||
margin-bottom: 2px; | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...app/modules/use-enterprise-marketing-link/use-enterprise-marketing-link.component.spec.ts
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,82 @@ | ||
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; | ||
import { UseEnterpriseMarketingLinkComponent } from './use-enterprise-marketing-link.component'; | ||
|
||
const lastShownDate = 'marketingMessageLastShownDate'; | ||
const lastMessageHash = 'marketingMessageLastHash'; | ||
|
||
describe('UseEnterpriseMarketingLinkComponent', () => { | ||
let spectator: Spectator<UseEnterpriseMarketingLinkComponent>; | ||
|
||
const createComponent = createComponentFactory({ | ||
component: UseEnterpriseMarketingLinkComponent, | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createComponent(); | ||
jest.spyOn(global.Date.prototype, 'toDateString').mockReturnValue('2025-02-26'); | ||
localStorage.clear(); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.restoreAllMocks(); | ||
}); | ||
|
||
it('should display the first message by default', () => { | ||
const message = spectator.component.currentMessage(); | ||
expect(message).toBe('Optimize Your Storage'); | ||
}); | ||
|
||
it('should rotate to the next message on a new day', () => { | ||
localStorage.setItem(lastShownDate, '2025-02-25'); | ||
localStorage.setItem(lastMessageHash, spectator.component.hashMessage('Optimize Your Storage')); | ||
|
||
const nextMessage = spectator.component.getTodaysMessage(); | ||
expect(nextMessage).toBe('More Performance, More Protection'); | ||
}); | ||
|
||
it('should loop to the first message after the last message', () => { | ||
localStorage.setItem(lastShownDate, '2025-02-25'); | ||
localStorage.setItem(lastMessageHash, spectator.component.hashMessage('5 Nines of Uptime with HA')); | ||
|
||
const nextMessage = spectator.component.getTodaysMessage(); | ||
expect(nextMessage).toBe('Optimize Your Storage'); | ||
}); | ||
|
||
it('should update localStorage with new date and hash', () => { | ||
spectator.component.getTodaysMessage(); | ||
|
||
expect(localStorage.getItem(lastShownDate)).toBe('2025-02-26'); | ||
expect(localStorage.getItem(lastMessageHash)).toBe(spectator.component.hashMessage('Optimize Your Storage')); | ||
}); | ||
|
||
it('should maintain consistent message even if array order changes', () => { | ||
const originalHash = spectator.component.hashMessage('Boost Performance & Support'); | ||
localStorage.setItem('marketingMessageLastShownDate', '2025-02-25'); | ||
localStorage.setItem('marketingMessageLastHash', originalHash); | ||
|
||
spectator.component.messages = [ | ||
'Boost Performance & Support', | ||
'Optimize Your Storage', | ||
'More Performance, More Protection', | ||
]; | ||
|
||
const nextMessage = spectator.component.getTodaysMessage(); | ||
expect(nextMessage).toBe('Optimize Your Storage'); | ||
}); | ||
|
||
it('should return the first message if hash is not found', () => { | ||
localStorage.setItem(lastShownDate, '2025-02-26'); | ||
localStorage.setItem(lastMessageHash, 'unknownHash'); | ||
|
||
const currentMessage = spectator.component.getTodaysMessage(); | ||
expect(currentMessage).toBe('Optimize Your Storage'); | ||
}); | ||
|
||
it('should not change message within the same day', () => { | ||
localStorage.setItem(lastShownDate, '2025-02-26'); | ||
localStorage.setItem(lastMessageHash, spectator.component.hashMessage('Optimize Your Storage')); | ||
|
||
const currentMessage = spectator.component.getTodaysMessage(); | ||
expect(currentMessage).toBe('Optimize Your Storage'); | ||
}); | ||
}); |
Oops, something went wrong.