Vue.directive('expand', {
inserted: function(el, binding)
{
if (binding.value !== null)
{
function calcHeight()
{
const currentState = el.getAttribute('aria-expanded')
el.classList.add('u-no-transition')
el.removeAttribute('aria-expanded')
el.style.height = null
el.style.height = el.clientHeight + 'px'
el.setAttribute('aria-expanded', currentState)
setTimeout(function()
{
el.classList.remove('u-no-transition')
})
}
el.classList.add('expand')
el.setAttribute('aria-expanded', (binding.value) ? 'true' : 'false')
calcHeight()
window.addEventListener('resize', calcHeight)
}
},
update: function(el, binding)
{
if (el.style.height && binding.value !== null)
{
el.setAttribute('aria-expanded', (binding.value) ? 'true' : 'false')
}
},
})
var app = new Vue({
el: '#app',
data: {
isExpanded: false
}
})
const map = {};
Window.addEventListener = jest.genMockFn().mockImpl((event, cb) => {
map[event] = cb;
});
map.event(...args);
import { mount } from 'enzyme';
...
describe('Editor', function () {
it('dispatch COMMAND_SAVE when command+s key pressesd', function () {
const dispatchSpy = sinon.spy();
dispatchSpy.withArgs(COMMAND_SAVE);
// 1. use `mount` API for Full DOM Rendering
const wrapper = mount(<Editor dispatch={dispatchSpy} />);
// 2. find a DOM element with '.public-DraftEditor-content' classname
const ed = wrapper.find('.public-DraftEditor-content');
// 3. dispatch the 'keyDown' event with `simulate` API
ed.simulate('keyDown', {
keyCode: KeyCode.KEY_S,
metaKey: false, // is IS_OSX=true, this should be true
ctrlKey: true,
altKey: false,
});
assert.equal(dispatchSpy.calledOnce, true);
assert.equal(dispatchSpy.withArgs(COMMAND_SAVE).calledOnce, true);
});
});
app.service('browser', ['$window', function($window) {
return function() {
const userAgent = $window.navigator.userAgent;
const browsers = {chrome: /chrome/i, safari: /safari/i, firefox: /firefox/i, ie: /internet explorer/i};
for(var key in browsers) {
if (browsers[key].test(userAgent)) {
return key;
}
};
return 'unknown';
}
}]);
class ScrollToTop extends Component {
onClick = () => {
if (this.element && this.element.parentNode) {
scrollIntoView(this.element.parentNode.parentNode, {
time: 500,
align: {
top: 0.1,
},
})
}
}
onSetRef = (element) => {
this.element = element
}
render() {
const { intl } = this.props
return (
<div
ref={this.onSetRef}
style={{ width: '100%' }}
>
<Layer
align='mc-mc'
constraints={[{
to: 'window',
attachment: 'none',
pin: ['top'],
}]}
classes={{
pinned: styles(),
}}
>
<div style={{ display: 'none', marginTop: 60, paddingRight: 40, paddingBottom: 20 }}>
<Text color='blue400'>
↑
</Text>
<Space />
<Link onClick={this.onClick}>
<Text color='blue400'>
{intl.formatMessage(messages.up)}
</Text>
</Link>
</div>
</Layer>
</div>
)
}
}
.checkout {
background-color: rgba(255, 255, 255, 0.988);
box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
padding: 4rem 1.5rem;
&Payment {
text-align: center;
width: 100px;
border: 1px solid #1e88e5;
border-radius: 3px;
padding: .6rem 0;
line-height: 1;
&_bank {
&-img {
background: url('../img/general/bank_creditCard.svg') no-repeat;
width: 18px;
height: 16px;
}
}
&_paypal {
&-img {
background: url('../img/general/bank_paypal.svg') no-repeat;
width: 18px;
height: 16px;
}
}
}
}
this.setState({welcome: "Привет Андрей"});
this.state.welcome = "Привет Андрей";