Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render(ele, container => {
const scroll = container.childAt(0)
expect(scroll instanceof gui.Scroll).toBeTruthy()
const size = scroll.getContentSize()
// NOTE: The value may be not accurate in windows
if (!win32) {
expect(size.width).toBe(contentSize.width)
expect(size.height).toBe(contentSize.height)
}
// expect(scroll.isOverlayScrollbar()).toBe(overlayScrollbar)
const policies = scroll.getScrollbarPolicy()
expect(policies[0]).toBe(hpolicy)
// TODO: not work for vpolicy
// expect(policies[1]).toBe(vpolicy)
done()
})
})
constructor(mainWindow) {
this.mainWindow = mainWindow
this.account = null
this.channelItems = []
this.dmItems = []
this.selectedChannelItem = null
this.view = gui.Container.create()
this.view.setStyle({width: 220})
this.view.setBackgroundColor('#2F3241')
this.accountHeader = new AccountHeader()
this.view.addChildView(this.accountHeader.view)
this.channelsListScroll = gui.Scroll.create()
this.channelsListScroll.setStyle({flex: 1})
if (process.platform === 'win32') {
// On Windows there is no overlay scrollbar.
this.channelsListScroll.setScrollbarPolicy('never', 'never')
} else {
// Force using overlay scrollbar.
this.channelsListScroll.setOverlayScrollbar(true)
this.channelsListScroll.setScrollbarPolicy('never', 'automatic')
}
this.view.addChildView(this.channelsListScroll)
this.channelsList = gui.Container.create()
this.channelsList.setStyle({paddingBottom: 15})
this.channelsListScroll.setContentView(this.channelsList)
this.channelTitle = new ChannelTitle('Channels')
constructor(mainWindow) {
this.mainWindow = mainWindow
this.channels = []
this.view = gui.Container.create()
this.view.setMouseDownCanMoveWindow(false)
this.view.setBackgroundColor('#FFF')
this.view.setStyle({flex: 1, padding: 20})
this.entry = gui.Entry.create()
this.entry.setStyle({width: '100%', marginBottom: 20})
this.entry.onTextChange = this.onTextChange.bind(this)
this.view.addChildView(this.entry)
this.scroll = gui.Scroll.create()
this.scroll.setStyle({flex: 1})
this.scroll.setScrollbarPolicy('never', 'automatic')
this.contentView = gui.Container.create()
this.contentView.onDraw = this.draw.bind(this)
this.scroll.setContentView(this.contentView)
this.view.addChildView(this.scroll)
this.hoverItem = null
this.contentView.onMouseMove = this.onMouse.bind(this)
this.contentView.onMouseEnter = this.onMouse.bind(this)
this.contentView.onMouseLeave = this.onMouse.bind(this)
this.contentView.onMouseUp = this.onClick.bind(this)
}