Forked from Gaurav0/controllers.application.js
Last active
December 15, 2020 01:58
-
-
Save jacobq/ff9ff22445f6215d4f238f6c35e2d4bc to your computer and use it in GitHub Desktop.
Modal Dialog Test
This file contains hidden or 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
// Problem happens regardless of duration, but unless using | |
// the `.velocity-animating` CSS hack it is easier to see with longer durations. | |
const options = {duration: 1000, easing: 'easeInOutQuad'}; | |
export default function(){ | |
this.transition( | |
// this works | |
//this.use('fade') | |
// this has a glitch; can see second copy/ghost of modal in top left when closing | |
this.use('explode', { | |
pick: '.ember-modal-dialog', | |
use: ['fade', options] | |
}, { | |
pick: '.ember-modal-overlay', | |
use: ['fade', options] | |
}) | |
); | |
}; |
This file contains hidden or 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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'ember-modal-dialog test', | |
show: false, | |
actions: { | |
toggle() { | |
this.toggleProperty('show'); | |
} | |
} | |
}); |
This file contains hidden or 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
/* Avoid scrollbars */ | |
body { | |
margin: 0; | |
padding: 0; | |
border: 0; | |
} | |
/* Hack #1 -- almost does the trick but still flashes briefly */ | |
/* | |
.ember-modal-overlay.velocity-animating .ember-modal-dialog { | |
display: none !important; | |
} | |
*/ | |
/* Hack #2 -- works but quite fragile (depends on liquid-fire explode ordering, etc.) */ | |
/* | |
.ember-modal-overlay ~ .ember-modal-dialog { | |
display: none !important; | |
} | |
*/ | |
/* Taken from ember-modal-structure.scss, adapted for compatibility */ | |
.ember-modal-dialog { | |
z-index: 51; | |
position: fixed; | |
} | |
.ember-modal-dialog.emd-in-place { | |
position: static; | |
} | |
.ember-modal-wrapper.emd-static.emd-wrapper-target-attachment-center .ember-modal-dialog { | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} | |
.ember-modal-wrapper.emd-animatable.emd-wrapper-target-attachment-center { | |
width: 100%; | |
width: 100vw; | |
height: 100%; | |
height: 100vh; | |
position: fixed; | |
top: 0; | |
left: 0; | |
z-index: 50; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
.ember-modal-wrapper.emd-animatable.emd-wrapper-target-attachment-center .ember-modal-overlay { | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
.ember-modal-wrapper.emd-animatable .ember-modal-dialog { | |
position: relative; | |
} | |
.ember-modal-overlay { | |
width: 100%; | |
width: 100vw; | |
height: 100%; | |
height: 100vh; | |
position: fixed; | |
top: 0; | |
left: 0; | |
z-index: 50; | |
} | |
/* Taken from ember-modal-appearance.scss and adapted for compatibility */ | |
.ember-modal-dialog { | |
border-radius: 8px; | |
background-color: #fff; | |
box-shadow: 0 0 10px #222; | |
padding: 10px; | |
} | |
.ember-modal-overlay.translucent { | |
background-color: grey; | |
background-color: rgba(127, 127, 127, 0.77); | |
background-color: rgba(#808080, .77); | |
} |
This file contains hidden or 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
import Ember from 'ember'; | |
export default function destroyApp(application) { | |
Ember.run(application, 'destroy'); | |
} |
This file contains hidden or 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
import Resolver from '../../resolver'; | |
import config from '../../config/environment'; | |
const resolver = Resolver.create(); | |
resolver.namespace = { | |
modulePrefix: config.modulePrefix, | |
podModulePrefix: config.podModulePrefix | |
}; | |
export default resolver; |
This file contains hidden or 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
import Ember from 'ember'; | |
import Application from '../../app'; | |
import config from '../../config/environment'; | |
const { run } = Ember; | |
const assign = Ember.assign || Ember.merge; | |
export default function startApp(attrs) { | |
let application; | |
let attributes = assign({rootElement: "#test-root"}, config.APP); | |
attributes = assign(attributes, attrs); // use defaults, but you can override; | |
run(() => { | |
application = Application.create(attributes); | |
application.setupForTesting(); | |
application.injectTestHelpers(); | |
}); | |
return application; | |
} |
This file contains hidden or 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
import resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
This file contains hidden or 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
{ | |
"version": "0.12.1", | |
"ENV": { | |
"ember-modal-dialog": { | |
"hasLiquidWormhole": "2.0.5", | |
"hasLiquidTether": "2.0.4", | |
"hasEmberTether": "1.0.0-beta.0" | |
} | |
}, | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js", | |
"ember": "2.12.0", | |
"ember-modal-dialog": "2.2.0", | |
"ember-tether": "1.0.0-beta.0", | |
"liquid-fire": "0.27.3", | |
"liquid-tether": "2.0.4", | |
"liquid-wormhole": "2.0.5" | |
}, | |
"addons": { | |
"liquid-fire": "0.27.3", | |
"liquid-tether": "2.0.4", | |
"liquid-wormhole": "2.0.5", | |
"ember-tether": "1.0.0-beta.0", | |
"ember-modal-dialog": "2.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment